Monday, December 16, 2013

difference between rest and next


(def x (next (random-ints 50)))
; realizing random number (evaluating first element)
; realizing random number (evaluating second element, which is the head of the tail)

(def x (rest (random-ints 50)))
; realizing random number

NOTE: ‘next’ tries to evaluate the head of the tail, while ‘rest’ does not, which is lazier than ‘next’

No comments:

Post a Comment