[plt-scheme] re: the fastest way to calc a cartesian product
>> An uncommented example:
>> ===========
>> (define cars (lambda (elt) (memq elt '(vw saab bmw audi))))
>> (define evens (lambda (elt) (and (number? elt) (even? elt))))
>>
>> (define (element-of? elt set) (set elt))
>>
>> (define (cartesian-product A B)
>> (lambda (elt)
>> (and (length=2? elt)
>> (element-of? (first elt) A)
>> (element-of? (first elt) B))))
>
> ITYM "second" ?
>
>
D'oh! That's what I get for not writing my tests until *after* I'd pasted
into the email, sigh. Thanks.
--Ian