(clj 8) Some notes on lazy sequences and function parameters

Almost done with the chapter 4 "Core Functions in Depth" of "Clojure for the Brave and True"! Before wrapping up the chapter with a longer example, a summary, and some exercises, the book goes into lazy sequences, the collection abstraction, and function functions. In this post I will share some notes on infinite lazy sequences and function parameters, making comparisons between Clojure and Python.

Infinite lazy sequences

A lazy sequence is a sequence whose members aren't computed until you try to access them. One advantage is that it's more efficient: the whole sequence doesn't have to be calculated and kept in memory from the start. Another advantage is that it allows you to create infinite sequences. Do that with a normal sequence and your program would never want to stop calculating.

Read more… (4 min remaining to read)