3 ms·
And if you want Python-style iterators, that's easy too: http://blog.rongarret.info/2008/02/joy-of-iterators.html http://blog.rongarret.info/2008/02/joy-of-ite
by lisper 12y ago
And if you want Python-style iterators, that's easy too:
http://blog.rongarret.info/2008/02/joy-of-iterators.html http://blog.rongarret.info/2008/02/joy-of-iterators.html
- ScottBurson 12y agoSo, that thing I mentioned yesterday that I wrote 35 years ago? It might interest you: https://github.com/slburson/misc-extensions Look in src/gmap.lisp. I admit it wouldn't work that well for 'n-at-a-time', but here's a closely related example: (defun alist-to-plist (alist) (gmap :plist nil (:alist alist))) There are some idiosyncrasies here: 'nil' is shorthand for the identity function (in this case, the two-argument, two-value identity function), and the use of keyword symbols is weird and potentially problematic, though I've never run into a problem with it in practice. This is the map-reduce model of iteration -- obviously not with support for distributed computation, but nonetheless useful for programming in the small. And far more elegant, to my eyes, than that LOOP monstrosity :-)