• Twitter

Saved searches

  • Remove
  • Verified account @
Suggested users
  • Verified account @
  • Verified account @
  • Language: English
    • Bahasa Indonesia
    • Bahasa Melayu
    • Čeština
    • Dansk
    • Deutsch
    • EnglishUK
    • Español
    • Filipino
    • français
    • Italiano
    • Magyar
    • Nederlands
    • Norsk
    • Polski
    • Português
    • română
    • Suomi
    • Svenska
    • Tiếng Việt
    • Türkçe
    • Русский
    • Українська мова
    • עִבְרִית
    • العربية
    • فارسی
    • हिन्दी
    • বাংলা
    • ภาษาไทย
    • 한국어
    • 日本語
    • 简体中文
    • 繁體中文
  • Have an account? Sign in New to Twitter? Join Today »
    Sign In

    Forgot password?
    Already using Twitter via text message?

Marc Harter ‏@wavded Apr 23

.@BrendanEich will proper TCO also work for generators when its implemented? - see http://gist.github.com/wavded/11233792 

  • Reply
  • Retweet Retweeted
  • Favorite Favorited
2:58 PM - 23 Apr 2014
  1. BrendanEich ‏@BrendanEich Apr 23

    @wavded yield* is in tail position there, but the expression it exhausts is not -- it's a divergent recursive call. JS is strict ("eager").

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  2. Marc Harter ‏@wavded Apr 23

    @BrendanEich I must not be understanding TCO here. Would you have a sec to comment on that gist with an proper TCO version? Recur fib gen.

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  3. BrendanEich ‏@BrendanEich Apr 23

    @wavded yield* is not return -- yield* E evaluates E eagerly, and exhausts it, yielding each value. return E where E is F() can tail-call F.

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  4. getify ‏@getify Apr 23

    @wavded first yield* will, when recursing to gen(), wait for both of its yields.. that's why it's not a single-op in tail pos @brendaneich

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  5. Marc Harter ‏@wavded Apr 23

    @getify @BrendanEich ok, so is it possible to infinitely recurse in a generator? if you have an example that may help me get it better.

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  6. BrendanEich ‏@BrendanEich Apr 23

    @wavded Think of yield* E as do{for (let V of E) yield V;} and follow @getify's point. Also note yield is not return, G.next() goes back.

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  7. getify ‏@getify Apr 23

    @brendaneich @wavded it doesn't seem like generators could ever be TCO'd. even one with only a single yield* in final pos is not a return.

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  8. Marc Harter ‏@wavded Apr 23

    @BrendanEich so yield* X is just a fancy way of exhausting all the yields from another generator (looping) and then continuing on...

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  9. BrendanEich ‏@BrendanEich Apr 23

    @getify Correct -- control can come back (send a value, even; also the close method, reborn as g.return() to force-return at yield). @wavded

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  10. BrendanEich ‏@BrendanEich Apr 23

    @getify In contast, once a function has return'ed that's it! No more resumption. @wavded

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  11. getify ‏@getify Apr 23

    @wavded FWIW, i like to think of yield* as delegating its own iterator control to another generator. @brendaneich

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  12. Marc Harter ‏@wavded Apr 23

    @BrendanEich @getify background for my questions; generators enable infinite, lazy, sequences - while() yield - wondered about recursion...

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  13. Marc Harter ‏@wavded Apr 23

    @getify @BrendanEich think I have it, it's like handing off "yields" to another generator, then continuing on?

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  14. JΞFF WAɌƉ ‏@jeffscottward Apr 23

    @BrendanEich @wavded @getify I wish I could understand this madness :(

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  15. BrendanEich ‏@BrendanEich Apr 23

    @wavded Just as noted yield* is eager. @getify

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  16. Marc Harter ‏@wavded Apr 23

    @BrendanEich @getify got it now, thanks for your help! I keep on thinking about lazy, infinitely recursive, Haskell-like functions in JS :)

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  17. getify ‏@getify Apr 23

    @wavded "handing off yields to another generator, then waiting for all of them to finish before going on." :) @brendaneich

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  18. getify ‏@getify Apr 23

    @jeffscottward you don't know JS yet. i'm writing some books to help. ;-)

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited
  19. Marc Harter ‏@wavded Apr 23

    @getify @BrendanEich I know, I just said that twice already right :) :)

    Expand Collapse
    • Reply
    • Retweet Retweeted
    • Favorite Favorited

    Don’t miss any updates from Marc Harter

    • © 2014 Twitter
    • About
    • Help
    • Ads info

    Flag this media

    This has already been marked as containing sensitive content.

    Learn more about flagging media
    Dismiss
    Previous
    Next

    Go to a person's profile

    Saved searches

    • Remove
    • Verified account @
    Suggested users
    • Verified account @
    • Verified account @

    Retweet this to your followers?

    Are you sure you want to delete this Tweet?

    Block

    • Add a location to your Tweets

      When you tweet with a location, Twitter stores that location. You can switch location on/off before each Tweet and always have the option to delete your location history. Learn more

    • Turn off location

    Profile summary

    Your lists

    Create a new list


    Under 100 characters, optional

    Privacy

    Embed this Tweet

    Add this Tweet to your website by copying the code below. Learn more

    Hmm, there was a problem reaching the server.

    Preview

    Sign up for Twitter

    Not on Twitter? Sign up, tune into the things you care about, and get updates as they happen.

    Have an account? Sign in »

    Two-way (sending and receiving) short codes:

    Country Code For customers of
    United States 40404 (any)
    Canada 21212 (any)
    United Kingdom 86444 Vodafone, Orange, 3, O2
    Brazil 40404 Nextel, TIM
    Haiti 40404 Digicel, Voila
    Ireland 51210 Vodafone, O2
    India 53000 Bharti Airtel, Videocon, Reliance
    Indonesia 89887 AXIS, 3, Telkomsel, Indosat, XL Axiata
    Italy 4880804 Wind
    3424486444 Vodafone
    » See SMS short codes for other countries

    Confirmation

    Buy Now

    Buy Now

    Hmm... Something went wrong. Please try again.