Common LISP addition program -
i trying write program takes in list of numbers , adds 1 each element in list. if list 0 return nil. tried doing recursively shows me no output. know it's simple beginner , hard me think problem recursively. thanks!
a list made of cons. has first value , list consisting of rest of list except first value. should check if list null (or endp same) , if isn't make cons calculation have first , recursive call using rest. argument.
(add-1 '(1 . (2 . (3 . ())))) ; ==> (2 . (3 . (4 . ()))) or more commonly written:
(add-1 '(1 2 3)) ; ==> (2 3 4)
Comments
Post a Comment