urbit/pub/docs/dev/hoon/runes/dt/dtls.md

67 lines
895 B
Markdown
Raw Normal View History

dotlus, `.+`, %dtls
2015-02-18 06:03:21 +03:00
============================
Increment
`.+` is a natural hoon that generates nock operator `4`, which
increments an atomic operand.
Produces
--------
Twig: `[%dtls p=twig]`
Sample
------
`p` is a [twig]()
Tall form
---------
.+ p
Wide form
---------
.+(p)
Irregular form
--------------
+(p)
Examples
--------
~zod/try=> +(6)
7
~zod/try=> +(2)
3
In the most straightforward case `.+` increments its operand.
~zod/try=> +(~zod)
1
/~zod/try=> `@`~zod
0
/~zod/try=> `@`'a'
97
~zod/try=> +('a')
98
/~zod/try=> `@`0xff
255
~zod/try=> +(0xff)
256
~zod/try=> +(41)
42
When passed a non-atomic odored atoms `.+` down-casts to an atom.
~zod/try=> +([1 2])
! type-fail
! exit
Passing an operand that cannot be directly down-cast to an atom produces
a type-fail.