rearrange elements in a List using Scheme
问题 I am trying to write a code using SCHEME that takes two arguments, for example '(2 1 3) & '(a b c) and gives a list '(b a c). My code is not working either recursive or iterative. Any help!! (define project (lambda (list1 list2 list3 n b index) (define n (length(list1))) (let ((i n)) (for-each (i) (cond ((null? list1) (display "empty")) (else (define n (car list1)) (define index (- n 1)) (define b (list-ref list2 index)) (define list3 (cons list3 b)) (define list1 (cdr list1)) list3 ))))))