Re: Generating cross recursive lazy sequences in clojure

2011-03-27 Thread Meikel Brandmeyer
Hi, On 28 Mrz., 07:11, Alan wrote: > (1) lazy-cat is old. There's no reason to use it anymore; lazy-seq is > better for generating custom lazy seqs, and concat is already lazy. You confuse this with lazy-cons. lazy-cat is just a really lazy version of concat and there is no reason not to use it

Re: Generating cross recursive lazy sequences in clojure

2011-03-27 Thread Alan
(1) lazy-cat is old. There's no reason to use it anymore; lazy-seq is better for generating custom lazy seqs, and concat is already lazy. (2) declare is overkill for this; just use letfn and avoid creating a bunch of global functions that nobody else will ever use. On Mar 27, 9:43 am, Christian Sc

Re: Generating cross recursive lazy sequences in clojure

2011-03-27 Thread Christian Schuhegger
Finally! I have a solution. You can have a look at it here: https://gist.github.com/889354/ I would like to hear comments about how to do it better or in a more idiomatic clojure way. Especially I am uncertain about my use of "binding" and the top level declares. I needed the ability to reference

Re: Generating cross recursive lazy sequences in clojure

2011-03-27 Thread Christian Schuhegger
I understand now the problem. Clojure is really not lazy enough :) I was forgetting that clojure evaluates its function arguments eagerly like lisp and not lazily like haskell. I have to wrap the function arguments that should be evaluated lazily into closures "(fn [] value)". Once I have a solut

Generating cross recursive lazy sequences in clojure

2011-03-27 Thread Christian Schuhegger
Hi all, I am continuing on my path to explore clojure in more detail and am trying to implement the following haskell algorithm in clojure: http://www.csse.monash.edu.au/~lloyd/tildeFP/Haskell/1998/Edit01/ Even after trying several different approaches and investing several hours I do not seem to