3 ms·
Fortunately, if you want that sort of thing in Lisp there's always the iterate library: https://common-lisp.net/project/iterate/ https://common-lisp.net/project
by zeveb 9y ago
Fortunately, if you want that sort of thing in Lisp there's always the iterate library: https://common-lisp.net/project/iterate/ https://common-lisp.net/project/iterate/
It looks pretty good to me, and I hear good things about it, although frankly I've always just used LOOP.
- bjoli 9y agoStill very much a language on its own. Rackets loops look very much like a regular lisp construct.
- deleted 9y ago[deleted]
- kbp 9y agoIt sounds like you're the kind of person who'd prefer DOTIMES[0], DOLIST[1], and so on. Lisp has a lot of different ways to handle iteration, it's the curse of flexibility when people have such varying tastes. Another great option that often gets overlooked is the Series package[2], which lets you write in a functional style and then mostly optimises that away. 0: http://www.lispworks.com/documentation/HyperSpec/Body/m_dotime.htm http://www.lispworks.com/documentation/HyperSpec/Body/m_doti... 1: http://www.lispworks.com/documentation/HyperSpec/Body/m_dolist.htm http://www.lispworks.com/documentation/HyperSpec/Body/m_doli... 2: http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node348.html#SECTION003410000000000000000 http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node348.html#S...
- bjoli 9y agoDOTIMES is not my cup of tea. I don't like to have to use mutation to get things done. I prefer to have an explicit but more verbose style (named let) or to use a for loop. A matter of preference of course. The benefits of for loops or named lets is that they are functional and thus continuation safe. I did a bunch of continuation-based nondeterminism things last year, and knowing things weren't mutating was nice.