cl:union   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

(define cl:union
  (letrec ((onion
      (lambda (lst1 lst2)
        (if (null? lst1)
      lst2
      (onion (cdr lst1) (cl:adjoin (car lst1) lst2))))))
    (lambda (lst1 lst2)
      (cond ((null? lst1) lst2)
      ((null? lst2) lst1)
      ((null? (cdr lst1)) (cl:adjoin (car lst1) lst2))
      ((null? (cdr lst2)) (cl:adjoin (car lst2) lst1))
      ((< (length lst2) (length lst1)) (onion (reverse lst2) lst1))
      (else (onion (reverse lst1) lst2))))))
;@


Back to Index

Similar Entries

  • cl:assoc-union    scheme
  • union    scheme
  • union    xtlang