How can I create an association list from 2 lists?
问题 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)) 回答1: 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 回答2: In C# 4.0 you can do it this way; var numbers = Enumerable.Range(1, 10).ToList<int>(); var abcs = new List<string>()