Here you go. Easy, with looping. Be a good thing to put into a module,
though. Looping can be slow.
Greg
==================== Cut Here ==============================
//
// time: Thu Aug 15 09:46:51 2002
//
// version: 3.1.2 (format), 4.2.0 (DX)
//
//
// MODULE main
// workspace: width = 633, height = 608
// layout: snap = 0, width = 50, height = 50, align = NN
//
macro main(
) -> (
) {
//
// node Construct[1]: x = 30, y = 14, inputs = 4, label = Construct
// input[1]: defaulting = 0, visible = 1, type = 16777224, value = {[0 0]}
// input[2]: defaulting = 0, visible = 1, type = 16777224, value = {[1 1]}
// input[3]: defaulting = 0, visible = 1, type = 8, value = [3 3]
// input[4]: defaulting = 0, visible = 1, type = 16777245, value = {1 .. 9}
//
main_Construct_1_out_1 =
Construct(
main_Construct_1_in_1,
main_Construct_1_in_2,
main_Construct_1_in_3,
main_Construct_1_in_4
) [instance: 1, cache: 1];
//
// node Selector[1]: x = 166, y = 16, inputs = 7, label = Selector
// input[1]: defaulting = 0, visible = 0, type = 32, value = "Selector_1"
// input[2]: defaulting = 0, visible = 0, type = 32, value = "y"
// input[3]: defaulting = 0, visible = 0, type = 29, value = 0
// input[4]: defaulting = 1, visible = 1, type = 16777248, value = { "x"
"y" }
// input[5]: defaulting = 1, visible = 0, type = 16777245, value = { 1 0 }
// output[1]: visible = 1, type = 29, value = 0
// output[2]: visible = 1, type = 32, value = "y"
//
//
// node Slice[1]: x = 70, y = 97, inputs = 3, label = Slice
//
main_Slice_1_out_1 =
Slice(
main_Construct_1_out_1,
main_Selector_1_out_2,
main_Slice_1_in_3
) [instance: 1, cache: 1];
//
// node Inquire[1]: x = 177, y = 151, inputs = 3, label = Inquire
// input[2]: defaulting = 0, visible = 1, type = 32, value = "member count"
//
main_Inquire_1_out_1 =
Inquire(
main_Slice_1_out_1,
main_Inquire_1_in_2,
main_Inquire_1_in_3
) [instance: 1, cache: 1];
//
// node Compute[1]: x = 132, y = 239, inputs = 2, label = Compute
// input[1]: defaulting = 0, visible = 0, type = 32, value = "$0-1"
// expression: value = a-1
// name[2]: value = a
//
main_Compute_1_out_1 =
Compute(
main_Compute_1_in_1,
main_Inquire_1_out_1
) [instance: 1, cache: 1];
//
// node Enumerate[1]: x = 117, y = 317, inputs = 5, label = Enumerate
// input[1]: defaulting = 0, visible = 1, type = 29, value = 1
// input[4]: defaulting = 0, visible = 1, type = 29, value = 1
//
main_Enumerate_1_out_1 =
Enumerate(
main_Enumerate_1_in_1,
main_Enumerate_1_in_2,
main_Compute_1_out_1,
main_Enumerate_1_in_4,
main_Enumerate_1_in_5
) [instance: 1, cache: 1];
//
// node Select[2]: x = 21, y = 347, inputs = 3, label = Select
//
main_Select_2_out_1 =
Select(
main_Slice_1_out_1,
main_Enumerate_1_out_1,
main_Select_2_in_3
) [instance: 2, cache: 1];
//
// node ForEachMember[1]: x = 70, y = 420, inputs = 1, label = ForEachMember
//
main_ForEachMember_1_out_1,
main_ForEachMember_1_out_2,
main_ForEachMember_1_out_3 =
ForEachMember(
main_Select_2_out_1
) [instance: 1, cache: 1];
//
// node Select[1]: x = 301, y = 213, inputs = 3, label = Select
// input[2]: defaulting = 0, visible = 1, type = 1, value = 0
//
main_Select_1_out_1 =
Select(
main_Slice_1_out_1,
main_Select_1_in_2,
main_Select_1_in_3
) [instance: 1, cache: 1];
//
// node Inquire[2]: x = 351, y = 86, inputs = 3, label = Inquire
// input[2]: defaulting = 0, visible = 1, type = 32, value = "object tag"
//
main_Inquire_2_out_1 =
Inquire(
main_Slice_1_out_1,
main_Inquire_2_in_2,
main_Inquire_2_in_3
) [instance: 2, cache: 1];
//
// node GetGlobal[2]: x = 558, y = 137, inputs = 3, label = GetGlobal
//
main_GetGlobal_2_out_1,
main_GetGlobal_2_out_2 =
GetGlobal(
main_Inquire_2_out_1,
main_GetGlobal_2_in_2,
main_GetGlobal_2_in_3
) [instance: 2, cache: 1];
//
// node Compute[3]: x = 403, y = 203, inputs = 3, label = Compute
// input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 == $1 ? 0
: 1"
// expression: value = a == b ? 0 : 1
// name[2]: value = a
// name[3]: value = b
//
main_Compute_3_out_1 =
Compute(
main_Compute_3_in_1,
main_Inquire_2_out_1,
main_GetGlobal_2_out_1
) [instance: 3, cache: 1];
//
// node GetGlobal[1]: x = 393, y = 303, inputs = 3, label = GetGlobal
//
main_GetGlobal_1_out_1,
main_GetGlobal_1_out_2 =
GetGlobal(
main_Select_1_out_1,
main_Compute_3_out_1,
main_GetGlobal_1_in_3
) [instance: 1, cache: 1];
//
// node Compute[2]: x = 283, y = 440, inputs = 3, label = Compute
// input[1]: defaulting = 0, visible = 0, type = 32, value = "$0+$1"
// expression: value = a+b
// name[2]: value = a
// name[3]: value = b
//
main_Compute_2_out_1 =
Compute(
main_Compute_2_in_1,
main_ForEachMember_1_out_1,
main_GetGlobal_1_out_1
) [instance: 2, cache: 1];
//
// node Route[1]: x = 245, y = 529, inputs = 2, outputs = 2, label = Route
//
main_Route_1_out_1,
main_Route_1_out_2 =
Route(
main_ForEachMember_1_out_3,
main_Compute_2_out_1
) [instance: 1, cache: 1];
//
// node Print[1]: x = 337, y = 546, inputs = 3, label = Print
// input[2]: defaulting = 0, visible = 1, type = 32, value = "rd"
//
Print(
main_Route_1_out_1,
main_Print_1_in_2,
main_Print_1_in_3
) [instance: 1, cache: 1];
//
// node SetGlobal[1]: x = 455, y = 459, inputs = 3, label = SetGlobal
//
SetGlobal(
main_Compute_2_out_1,
main_GetGlobal_1_out_2,
main_SetGlobal_1_in_3
) [instance: 1, cache: 1];
//
// node SetGlobal[2]: x = 543, y = 250, inputs = 3, label = SetGlobal
//
SetGlobal(
main_Inquire_2_out_1,
main_GetGlobal_2_out_2,
main_SetGlobal_2_in_3
) [instance: 2, cache: 1];
// network: end of macro body
}
main_Construct_1_in_1 = {[0 0]};
main_Construct_1_in_2 = {[1 1]};
main_Construct_1_in_3 = [3 3];
main_Construct_1_in_4 = {1 .. 9};
main_Construct_1_out_1 = NULL;
main_Selector_1_in_1 = "Selector_1";
main_Selector_1_in_2 = "y" ;
main_Selector_1_in_3 = 0 ;
main_Selector_1_in_4 = NULL;
main_Selector_1_in_5 = NULL;
main_Selector_1_in_6 = NULL;
main_Selector_1_in_7 = NULL;
main_Selector_1_out_2 = "y" ;
main_Slice_1_in_3 = NULL;
main_Slice_1_out_1 = NULL;
main_Inquire_1_in_2 = "member count";
main_Inquire_1_in_3 = NULL;
main_Inquire_1_out_1 = NULL;
main_Compute_1_in_1 = "$0-1";
main_Compute_1_out_1 = NULL;
main_Enumerate_1_in_1 = 1;
main_Enumerate_1_in_2 = NULL;
main_Enumerate_1_in_4 = 1;
main_Enumerate_1_in_5 = NULL;
main_Enumerate_1_out_1 = NULL;
main_Select_2_in_3 = NULL;
main_Select_2_out_1 = NULL;
main_ForEachMember_1_out_1 = NULL;
main_ForEachMember_1_out_3 = NULL;
main_Select_1_in_2 = 0;
main_Select_1_in_3 = NULL;
main_Select_1_out_1 = NULL;
main_Inquire_2_in_2 = "object tag";
main_Inquire_2_in_3 = NULL;
main_Inquire_2_out_1 = NULL;
main_GetGlobal_2_in_2 = NULL;
main_GetGlobal_2_in_3 = NULL;
main_GetGlobal_2_out_1 = NULL;
main_GetGlobal_2_out_2 = NULL;
main_Compute_3_in_1 = "$0 == $1 ? 0 : 1";
main_Compute_3_out_1 = NULL;
main_GetGlobal_1_in_3 = NULL;
main_GetGlobal_1_out_1 = NULL;
main_GetGlobal_1_out_2 = NULL;
main_Compute_2_in_1 = "$0+$1";
main_Compute_2_out_1 = NULL;
main_Route_1_out_1 = NULL;
main_Print_1_in_2 = "rd";
main_Print_1_in_3 = NULL;
main_SetGlobal_1_in_3 = NULL;
main_SetGlobal_2_in_3 = NULL;
Executive("product version 4 2 0");
$sync
main();