merits of Lisp vs Python
Paul Rubin
http
Mon Dec 11 08:28:43 EST 2006
Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> (defun sum_to_n (n &optional (acc 0))
> ;; (sum_to_n n) computes sum of integers from 0 to n
> (if (= n 0)
> 0
> (sum_to_n (- 1 n) (+ n acc))))
Of course meant:
(defun sum_to_n (n &optional (acc 0))
;; (sum_to_n n) computes sum of integers from 0 to n
(if (= n 0)
acc
(sum_to_n (- 1 n) (+ n acc))))
I've made that same error several times in Haskell as well. I'm not
used to this.
More information about the Python-list
mailing list