cartesian product

Posted by John Retallack on Stack Overflow See other posts from Stack Overflow or by John Retallack
Published on 2010-03-20T23:47:18Z Indexed on 2010/03/20 23:51 UTC
Read the original article Hit count: 460

I've been trying to do a function that returns the Cartesian Product of n sets,in Dr Scheme,the sets are given as a list of lists,I've been stuck at this all day,I would like a few guidelines as where to start,I've wrote a pice of code but it dosen't work.

(define cart-n(?(l)
          (if (null? l)  '(())
              (map
               (?(lst) (cons (car ( car(l))) lst))
               (cart-n (cdr l) )))))

© Stack Overflow or respective owner

Related posts about functional-programming

Related posts about Scheme