by bh
See Code Download Embed
Lists of lists of functions!

Green flag to display every possible ice cream serving; space to display every possible pizza serving.

Each of the grey ("other") reporters such as SMALL and VANILLA takes a Boolean input.  If the input is TRUE, it reports its name as a text string; if the input is FALSE it reports a command script that can be RUN to draw its part of the picture.

CROSSPRODUCT takes a list of lists, each of which is a mutually exclusive option, e.g., [small medium large].  It reports a list of lists in which each sublist contains one item from each of the original option lists:

    ==>  [[A X] [A Y] [B X] [B Y] [C X] [C Y]]

It's called "crossproduct" because if the input is viewed as a list of sets, it reports the Cartesian cross product of those sets.

The cool thing is that there can be any number of sets, each with any number of items, because crossproduct is written as a tree recursion rather than as a nested loop.

Created January 12, 2014

Last updated December 21, 2018

Published July 23, 2018