Advertisement
Guest User

Untitled

a guest
Jan 11th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.61 KB | None | 0 0
  1. (define (fooBar l1 l2)
  2.  
  3.   (define (foo1 x y lst1 list2)
  4.     (cond
  5.       ((and (null? list1) (null? list2)) null)
  6.       ((null? list1) (foo2 y y list1 list2))
  7.       ((= x 0) (cons (car list1) (foo2 (+ y 1) (+ y 1) (cdr list1) list2)))
  8.       (else (cons (car list1) (foo1 (- x 1) y (cdr list1) list2))))))
  9.  
  10.   (define (foo2 x y list1 list2)
  11.     (cond
  12.       ((and (null? list1) (null? list2)) null)
  13.       ((null? list2) (foo1 y y list1 list2))
  14.       ((= x 0) (cons (car list2) (foo1 (+ y 1) (+ y 1) list1 (cdr list2))))
  15.       (else (cons (car list2) (foo2 (- x 1) y list1 (cdr list2))))))
  16.  
  17.   (foo1 0 0 l1 l2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement