May 2018
Beginner to intermediate
290 pages
6h 43m
English
We can see one of the more useful applications of lazy sequences in nREPL,[20] a library that enables you to create a client/server rendition of a REPL, where the client sends Clojure expressions off to a server, which evaluates them and sends back the results. Here’s the sequence:
| | (repeatedly #(transport/recv transport timeout)) |
The repeatedly function is the function-driven equivalent of repeat. Instead of returning the same value over and over, repeatedly calls the function you pass in over and over, returning a lazy sequence of the resulting values. The repeatedly function is useful in those situations where you are dealing with side effects—presumably you will get something different back from the repeated calls to the function. ...
Read now
Unlock full access