[Technical, short] Lazy-seq in Clojure

Hi all, a pro-memoria for myself about lazy-sequences (lazy-seq) and how to use them. Using lazy-seq is, at the moment, the hardest topic in my Clojure journey.

Frank (I told you it is a post for myself) the next time you think about creating a lazy-sequence in Clojure remember:

  • This is a good summary page of the struggles – http://www.thesoftwaresimpleton.com/blog/2014/09/08/lazy-seq/
  • The official doc page for lazy-seq is https://clojuredocs.org/clojure.core/lazy-seq
  • The most important thing to keep in mind is:
;; It might be easier to think about the producer function as a function
;; that, given element n, produces element n+1 via a recursive call to 
;; itself, wrapped with lazy-seq to delay its execution

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.