diff --git a/tk/listlogic.scm b/tk/listlogic.scm index 885e51f..5e11bbe 100644 --- a/tk/listlogic.scm +++ b/tk/listlogic.scm @@ -18,6 +18,17 @@ ;;the entries in that list are 'unwrapped'. This occurs recursively. (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 ;;as that evauluation results in #t. (define (lp& p ls1 ls2)