tags:

views:

49

answers:

1

How can you go from (5 . 2) to (5 2) ??

+4  A: 

Is this what you're looking for?

(define (pair-to-list pp)
    (list (car pp) (cdr pp)))

(pair-to-list '(5 . 2))
(pair-to-list (cons 5 2))
xscott
well if I do (list (5 . 2)) ill get ((5 2)) and I only want (5 2)
user258875
Actually, that's not correct. You'll get an error on (list (5 . 2)). But if you call (pair-to-list '(5 . 2)), you'll get what you want.
xscott
Ok never mind I got it. Thank you
user258875