Clojure.core/lazy-seq makes sense
codemeself.blogspot.com
Clojure.core/lazy-seq makes sense
1–6 of 6 posts
Re: Clojure.core/lazy-seq makes sense
#2Re: Clojure.core/lazy-seq makes sense
#3Re: Clojure.core/lazy-seq makes sense
#4when should you use lazy opposed to traditional eager evaluation? (I understand how it works) But I don't see exactly when lazy would be the preferred evaluation. It smells a bit like premature optimization.
Re: Clojure.core/lazy-seq makes sense
#5when should you use lazy opposed to traditional eager evaluation? (I understand how it works) But I don't see exactly when lazy would be the preferred evaluation. It smells a bit like premature optimization.
Thanks for feedback. If your seq is created by some expensive computation (i.e. primes) than it makes a lot of sense to do it lazy.
Re: Clojure.core/lazy-seq makes sense
#6Earlier quoted context omitted.
Thanks for feedback. If your seq is created by some expensive computation (i.e. primes) than it makes a lot of sense to do it lazy.
so by expensive you mean a growth of n^2 or n^3, worse?
One thing that you can not do for sure with non-lazy is to construct infinite seq. Even when you create one lazy way, you have to "loose head" so elements can get GCed.
HTH