|
|
|
@ -18,6 +18,17 @@
|
|
|
|
;;the entries in that list are 'unwrapped'. This occurs recursively.
|
|
|
|
;;the entries in that list are 'unwrapped'. This occurs recursively.
|
|
|
|
(define (flatten lst) (flatten-helper lst '() '()))
|
|
|
|
(define (flatten lst) (flatten-helper lst '() '()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; A flat cons. Normal cons returns a list with a nested association in the
|
|
|
|
|
|
|
|
;;car position if x is a list, this function eliminates that assocation,
|
|
|
|
|
|
|
|
;;recursively "flattening" x and combining it's cdr with y.
|
|
|
|
|
|
|
|
(define (fcons x y)
|
|
|
|
|
|
|
|
(cond ((pair? x)
|
|
|
|
|
|
|
|
(fcons (car x) (fcons (cdr x) y)))
|
|
|
|
|
|
|
|
((null? x)
|
|
|
|
|
|
|
|
y)
|
|
|
|
|
|
|
|
(else
|
|
|
|
|
|
|
|
(cons x y))))
|
|
|
|
|
|
|
|
|
|
|
|
;; Evaluates (p (car ls1) (car ls2)) and accumulate into a return list as long
|
|
|
|
;; Evaluates (p (car ls1) (car ls2)) and accumulate into a return list as long
|
|
|
|
;;as that evauluation results in #t.
|
|
|
|
;;as that evauluation results in #t.
|
|
|
|
(define (lp& p ls1 ls2)
|
|
|
|
(define (lp& p ls1 ls2)
|
|
|
|
|