I don't understand whats wrong. Error looks cryptic to me :-\
;; ACL Paul Graham, Chpater 3 Exercise 5
;; Supppose the funtion pos+ takes a list and returns a list of
;; "each element + its position"
;; (pos+ '(7 5 1 4)) ==> (7 6 3 7)
;; define this function using (a) recursion (b) iteration (c) mapcar
(defun pos+ (x)
(mapcar #'(lambda (let ((idx 0))
(+ x idx)
(+ idx 1))) x))
================== OUTPUT ==========================
[34]> (load "ACL-ch-3-exr-5.lisp")
;; Loading file ACL-ch-3-exr-5.lisp ...
;; Loaded file ACL-ch-3-exr-5.lisp
T
[35]> (pos+ '(1 2))
*** - APPLY: argument list given to SYSTEM::ERROR-OF-TYPE is dotted
(terminated by
"Invalid specialized parameter in method lambda list (LET ((IDX 0))
(+ X IDX) (+ IDX 1)): ((IDX 0))")
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [36]>
--
arnuld
http://LispMachine.Wordpress.com