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
2010-10-27 04:28:02
well if I do (list (5 . 2)) ill get ((5 2)) and I only want (5 2)
user258875
2010-10-27 04:37:55
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
2010-10-27 04:40:55
Ok never mind I got it. Thank you
user258875
2010-10-27 04:41:58