4 ms·
You have let [0], why would you need a special loop function? [0] http://jtra.cz/stuff/lisp/sclr/let.html http://jtra.cz/stuff/lisp/sclr/let.html Edit: That
by shakna 10y ago
You have let [0], why would you need a special loop function?
[0] http://jtra.cz/stuff/lisp/sclr/let.html http://jtra.cz/stuff/lisp/sclr/let.html
Edit:
That is to say, this is a simplified reference, and loop is a macro, not a special form.
- kgwgk 10y agoThis response makes no sense. Most of the functions in that page are not special forms. And both "car" and "first" are included! And "cdr" and "rest". And there are other functions that can be trivially obtained by the composition of two functions.
- Koshkin 10y agoNote that both CAR and CDR refer to parts of a CONS cell which does not necessarily represent a list.
- kgwgk 10y agoThat doesn't change the fact that car and first are two names for one single function (the same applies to cdr and rest). (The point is that the absence of loop cannot be explained because it's not "needed".)
- juki 10y agoI assume you're thinking about Schemes `(let loop (...) ...)`, but that doesn't exist in Common Lisp. CL:LOOP is a looping macro with its own small DSL. (loop :for i :below 5 :when (evenp i) :collect i) ;=> (0 2 4)
- lispm 10y agoThat's a step up from loops with 'goto': (prog ((result '()) (i 0)) loop (when (>= i 5) (return (reverse result))) (when (evenp i) (push i result)) (incf i) (go loop))