urbit/base/pub/doc/hoon/runes/cn/cndt.md

58 lines
955 B
Markdown
Raw Normal View History

2015-02-18 06:03:21 +03:00
[cendot, `%.`, %cndt](#cndt)
============================
Slam, reverse order
`%.` is a synthetic rune that reverses the order of [`%-`](). `%.`
exists primarily for code readability and organization, see the [style
guide]().
Produces
--------
Twig: `[%cndt p=twig q=twig]`
Sample
------
`p` and `q` are [twig]()s.
Tall form
---------
%. p
q
Wide form
---------
%.(p q)
Irregular form
--------------
None
Examples
--------
/~zod/try=> (dec 42)
41
~zod/try=> %.(42 dec)
41
In the most straightforward case `%.` allows us to reverse the order of
arm and arguments.
/~zod/try=> %.
%+ add
%+ mul 2 20
2
dec
41
Here we add `2` to the product of `2` and `20`, and use `%.` to
decrement our result. As you can see, `%.` is most useful for code
organization, when you need to compute intermediate products for your
final result.