Lazy sequences with circular definition

2010-11-19 Thread babui
I've been playing with lazy sequences defined by autoreferential definition. For instance: (def ones (lazy-seq (cons 1 ones))) which is equivalent to (def ones (repeat 1)). My problem arises when defining the sequence of fibonacci numbers. With this definition: (def fibs (lazy-seq (list* 0 1

Re: Lazy sequences with circular definition

2010-11-19 Thread Christophe Grand
Hi, On Fri, Nov 19, 2010 at 11:44 AM, babui jmgim...@gmail.com wrote: I've been playing with lazy sequences defined by autoreferential definition. For instance: (def ones (lazy-seq (cons 1 ones))) which is equivalent to (def ones (repeat 1)). My problem arises when defining the sequence

Re: Lazy sequences with circular definition

2010-11-19 Thread babui
Thanks for your explanation which has allowed me to make this definition (def fibs (list* 0 1 (lazy-seq (map + fibs (rest fibs) that uses rest and IMHO is clearer that the first one using drop. Juan Manuel On 19 nov, 12:04, Christophe Grand christo...@cgrand.net wrote: Hi, On