On Jun 26, 8:23 pm, _hrrld <hhaus...@gmail.com> wrote: > Hi, > > I'm trying to use lazy-seq to implement a cool piece of functionality > I saw in the Factor programming language. Here is the documentation > for that > functionality:http://docs.factorcode.org/content/word-produce,sequences.html > > I think a lazy version of Factor's "produce" word would be super- > powerful for some of the things I'm working on. > > This is the first time I've tried to create my own lazy sequence, so > don't laugh. > > Here is my attempt:http://gist.github.com/136825 > > For some reason, the lazy sequence that is returned is always empty > (?) or at least seems that way. > > Am I doing something silly? Or perhaps I've misunderstood lazy-seq's > operation.
Lazy-seq is tricky to use. It's also often not necessary. If you can implement yours in terms of map, reduce, or something else you should do so. But sometimes all you can think of is a way to generate items in a loop, often a stateful loop. Someone posted a macro here a few weeks ago that is supposed to be easier to use than lazy-seq. Search the forum for "lazy-seq" and see if you can find it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---