I found what doesn't work (?) in clisp.
let doesn't survive through recursion.
According to what I understand (let count, below) should survive through
recursive calls.
This func
pos+ takes a list of ints, and return the list of each
int incremented by it's index.
(an exercise from a book to do recursively, so please don't postmapcar solutions)
so (7 5 1 4) = ( 7 6 3 7)
(7+0 6+1 1+2 4+3)
(with debugging format)
Code:
(defun pos+ (L)
(let ((n (if (boundp 'count) count 0)))
(let ((count n ))
(format t "~%count = ~a" count)
(cond
((endp L) nil)
( t
(setf count (+ 1 count))
(cons (+ n (car L) ) (pos+ (cdr L))))))))
(do-form (pos+ '(7 5 1 4)))
Now in Interleaf lisp this works:
Code:
count = 0
count = 1
count = 2
count = 3
count = 4
(pos+ (quote (7 5 1 4))) = (7 6 3 7)
but in clisp:
Code:
count = 0
count = 0
count = 0
count = 0
count = 0
(pos+ (quote (7 5 1 4))) = (7 5 1 4)
Now, i think this means that
clisp is broken
What do you think?