Show HN: LazyCode – C++14 composable, lazily evaluated map, filter, fold
github.com
github.com
This is the TXR Lisp interactive listener of TXR 204.
Quit with :quit or Ctrl-D on empty line. Ctrl-X ? for cheatsheet.
1> (take 15 [keep-if* oddp (mapcar* [dup *] (range 0))])
(1 9 25 49 81 121 169 225 289 361 441 529 625 729 841)
Lazy keep-if: http://www.kylheku.com/cgit/txr/tree/lib.c?id=c310771b221125...Lazy mapcar: http://www.kylheku.com/cgit/txr/tree/eval.c?id=c310771b22112...
Lazy range: http://www.kylheku.com/cgit/txr/tree/eval.c?id=c310771b22112...
P.S. dup generates a one-argument function which duplicates its argument into two places and calls another function. [dup *] gives us a squaring function, thus.
Personally, I think I'd be more apt to use the "functional" style.