10 lines
356 B
Text
10 lines
356 B
Text
fcn amb(f,a,b,etc){
|
|
fcn(sink,f,a,b,etc){
|
|
abc:=vm.arglist[2,*]; // ((the,that),(frog,elephant))
|
|
if(abc.len()<2) return(sink.write(abc[0][0])); // back out of recursion
|
|
foreach a,b in (abc[0],abc[1]){ // Cartesian product
|
|
if(f(a,b)) self.fcn(sink,f,T(String(a," ",b)),abc[2,*].xplode());
|
|
}
|
|
}(s:=List(),vm.pasteArgs());
|
|
s
|
|
}
|