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

Popular posts from this blog

Java 3D LWJGL collision -

methods - python can't use function in submodule -

c# - ErrorThe type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?) -