2011-05-23, 06:04 PM
Arc (lisp dialect)
I don't think it gets any easier. Maybe tail-recursion is more elegant?
Arc again
(Quick and dirty CLISP)
Orrr, since you'll usually have some sort of range-function defined
Code:
(for (i 1 10)
(prn i))I don't think it gets any easier. Maybe tail-recursion is more elegant?
Arc again
Code:
(def accum (acc)
(prn acc)
(if (< acc 10)
(accum (1+ acc))))
(accum 1)(Quick and dirty CLISP)
Code:
(loop for i from 1 to 10
do (print i))Orrr, since you'll usually have some sort of range-function defined
Code:
(defun range (a b)
(loop for i from a to b
collect i))
(format t "~{~D~%~}"
(range 1 10))
