20 lines
836 B
Text
20 lines
836 B
Text
( ( testproc
|
|
= i x y z
|
|
. out$"Calling testproc"
|
|
& (=~):(=?i:?x:?y:?z) { initialise variables to 'failure' }
|
|
& !arg
|
|
: (? (i,?i) ?|?) { if "i" found, assign value to i. Otherwise just match with no side effect. }
|
|
: (? (x,?x) ?|?) { if "x" found, assign value to x. Otherwise just match with no side effect. }
|
|
: (? (y,?y) ?|?) { likewise }
|
|
: (? (z,?z) ?|?) { likewise }
|
|
& (~!i|put$(" i:=" !i)) { if variable doesn't fail, show its value }
|
|
& (~!x|put$(" x:=" !x))
|
|
& (~!y|put$(" y:=" !y))
|
|
& (~!z|put$(" z:=" !z))
|
|
& put$\n { add new line }
|
|
)
|
|
& testproc$((x,1) (y,2) (z,3))
|
|
& testproc$((x,3) (y,1) (z,2))
|
|
& testproc$((z,4) (x,2) (y,3)) { order is not important }
|
|
& testproc$((i,1) (y,2) (z,3))
|
|
);
|