Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Named-parameters/Bracmat/named-parameters.bracmat
Normal file
20
Task/Named-parameters/Bracmat/named-parameters.bracmat
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
( ( 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))
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue