;; Return a list of pairs of elements from lst1 and lst2.
;; In other words, return an association list with keys from lst1 and values from lst2.
;; The list is as long as the shortest of lst1 and lst2.
Show source file in small font In other-source: Link from pair-up to it's cross reference table entry 1.3. The next steps
(define (pair-up lst1 lst2) (pair-up-1 lst1 lst2 '())) Show source file in small font In other-source: Link from pair-up-1 to it's cross reference table entry 1.3. The next steps
(define (pair-up-1 lst1 lst2 res) (cond ((or (null? lst1) (null? lst2)) (reverse res)) (else (pair-up-1 (cdr lst1) (cdr lst2) (cons (cons (car lst1) (car lst2)) res))))) Show source file in small font In other-source: Link from key-list to it's cross reference table entry 1.3. The next steps
(define key-list '(a b c d)) Show source file in small font In other-source: Link from val-list to it's cross reference table entry 1.3. The next steps
(define val-list '(1 2 3 4)) Show source file in small font In other-source: Link from aref-assignment to it's cross reference table entry 1.3. The next steps
; aref-assignment ; definition and assignment of an-a-list. Show source file in small font In other-source: Link from an-a-list to it's cross reference table entry 
(define an-a-list '()) (set! an-a-list (pair-up key-list val-lst))