Comment by SatvikBeri
16 hours ago
This isn't really true – you have languages like Odin that only have a for loop, no while loop, that only supports index-based iteration. Then you have languages like Python that let you loop over an arbitrary iterable, and define your own iterables. Some languages allow conditionals in loops, some don't. Some let you loop over multiple iterables, while some only take one at a time.
Common Lisp happens to be on the upper end of what loop allows – you can use it as a standard for loop pretty easily, but the interface gives you many other options.
And then there's Scheme, where there are no iterative loops; all looping is done with recursion. You can build pretty much everything other languages do with loops on top of that, though.
Not true. Scheme has `do`. See R7RS section 4.2.4 "Iteration".
Scheme's `do` is implemented using recursion. There's a sample macro for it in 7.3.
> Common Lisp happens to be on the upper end of what loop allows – you can use it as a standard for loop pretty easily, but the interface gives you many other options.
If you really wanna get freaky try 'do. It is the heroin addicted cousin of 'loop
https://www.lispworks.com/documentation/HyperSpec/Body/m_do_...
`do` is very straightforward and basic compared to the things that `loop` allows.
oh no. maybe you have in mind 'dolist or 'dotimes
'do is much more general and way more powerful. in some sense 'loop is the taming of 'do. see for example
https://www.lispworks.com/documentation/lcl50/loop/loop-7.ht...
6 replies →