On Oct 15, 12:33 pm, CuppoJava <[EMAIL PROTECTED]> wrote:
> Hi Meikel,
> That solution will work for this simple case, but my goal is to make
> it possible to create lazy-sequences in a more straight-forward
> manner. So that we can use the usual sequence functions (doseq, dorun,
> loop) instead of the lazy-equivalents (for).

I think Meikel's solution looks much cleaner, and is shorter. Also,
calling doseq and dorun 'the usual' isn't really the case for Clojure
-  both are imperative, and less frequently used in idiomatic code.

> Is what I'm asking for impossible?

Nothing is impossible, but what you are asking for is imperative
generators. Any such generators have to know about any iteration
constructs they may contain, and how to transform them. The C#
spec[1]  has an example of how they are implemented. You'd need to
make a macro that expanded into a multi-way conditional with each
branch doing a lazy-cons onto a recursive call with the new state.

Generators might make sense for an imperative language, but they would
be inelegant and non-idiomatic for Clojure, IMO.

Rich

[1] 
http://download.microsoft.com/download/3/8/8/388e7205-bc10-4226-b2a8-75351c669b09/CSharp%20Language%20Specification.doc
--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to