mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-24 07:26:51 +03:00
1006 B
1006 B
cenlus, %+
, %cnls
Slam, two arguments
%+
is a synthetic rune that that pulls [$
] from the door p
with its sample set to [%cntr q r]
. %+
in the most common case
simply slams p
with q
and r
, similar to a function call with
two arguments.
Produces
Twig: [%cnls p=twig q=twig r=twig]
Sample
p
is a twig, most commonly a gate. q
and r
are twigs.
Tall form
%+ p
q
r
Wide form
%+(p q r)
Irregular form
None
Examples
/~zod/try=> =a |= [b=@ c=@]
(add b c)
new var %a
/~zod/try=> %+ a
2
1
3
/~zod/try=> %+(a 2 3)
5
First we set a shell variable a
to be a gate that takes two arguments
and produces their sum. Then we use %+
to pass values to our gate.
%+
is most useful for code organization, when you need to compute
intermediate products for your final computation.