cl:intersection   scheme


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

Implementation

(define (cl:intersection lst1 lst2)
   (if (null? lst2)
       lst2
       (let build-intersection ((lst1 lst1)
        (result '()))
    (cond ((null? lst1)
     (if (null? result)
         '()
         (reverse result)))
    ((member (car lst1) lst2)
     (build-intersection (cdr lst1) (cons (car lst1) result)))
    (else (build-intersection (cdr lst1) result))))))
;@


Back to Index

Similar Entries

  • impc:ti:intersection*    scheme
  • intersection    scheme
  • intersection    xtlang
  • plane_intersection    xtlang