In lisp/scheme, is there any form using set product as function input? map form uses n length-equal lists for a function which needs n arguments. Sometimes, we need the arguments to come from the product of a group of sets. For example:
(pmap (λ (d p) foo)
A B)
Here, list A may have different length with B, and pmap feeds each element of the product of A and B to the lambda expression.
Form for* of scheme/racket can do this job:
(for* ([x '(0 2 4)]
[y '(1 3 5)])
((λ (d p)
(printf "(~a, ~a)\n" d p))
x y))
Output:
(0, 1)
(0, 3)
(0, 5)
(2, 1)
(2, 3)
(2, 5)
(4, 1)
(4, 3)
(4, 5)
I want to know whether there exists other means similar to map or fold to do this in scheme.