Can anyone help me trace this LISP expression execution? -


l1 = ((a b) c d) l2 = ((e) f) 

the expression i'm supposed evaluate is: (cons (car l1) (list (cdr l2)))

i've traced out follows:

(cons (car l1) (list (cdr l2))) (cons ((a b)) (list ((f)))) (cons ((a b)) (((f)))) ((((a b)) (((f))))) 

or (i'm not sure if more readable or not, i've pressed space many times out now):

(  (   (    (a b)   )   (    (     (f)    )   )  ) ) 

is correct? seems there's entirely many parentheses, maybe i'm being paranoid?

none of examples can find have nested lists this, i'm not sure if i'm doing right.

thanks

cl-user 13 > (step (cons (car l1) (list (cdr l2)))) (cons (car l1) (list (cdr l2))) -> :s    (car l1) -> :s       l1 -> :s       ((a b) c d)     (a b)     (list (cdr l2)) -> :s       (cdr l2) -> :s          l2 -> :s          ((e) f)        (f)     ((f))  ((a b) (f))  

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -