In DrScheme, how can I create an association list from 2 lists?
For example, I have,
y = ( 1 2 3 )
x = ( a b c )
and I want
z = ((a 1) (b 2) (c 3))
Assuming Scheme (since your last 2 questions are on Scheme):
(define x '(1 2 3))
(define y '(4 5 6))
(define (zip p q) (map list p q)) ;; <----
(display (zip x y))
;; ((1 4) (2 5) (3 6))
Result: http://www.ideone.com/DPjeM
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With