on 514b5fc help sign in
98 lines 3.6 kB history raw
1+++
2title = "Auras"
3weight = 70
4template = "doc.html"
5+++
7Auras are system of nested "soft types" on [atoms](/docs/glossary/atom) that
8are used to track metadata about how a particular atom is to be interpreted.
9This is used for type checking as well as pretty printing.
11You can learn more about auras in [Hoon school](/docs/hoon/hoon-school/atoms-auras-and-simple-cell-types).
13### Table of Auras
15```
16Aura Meaning Example Literal Syntax
17-------------------------------------------------------------------------
18@ empty aura
19@c Unicode codepoint ~-~45fed
20@d date
21 @da absolute date ~2018.5.14..22.31.46..1435
22 @dr relative date (ie, timespan) ~h5.m30.s12
23@f Loobean (for compiler, not castable) &
24@i Internet address
25 @if IPv4 address .195.198.143.90
26 @is IPv6 address .0.0.0.0.0.1c.c3c6.8f5a
27@n nil (for compiler, not castable) ~
28@p phonemic base (ship name) ~sorreg-namtyv
29@q phonemic base, unscrambled .~litsyn-polbel
30@r IEEE-754 floating-point
31 @rh half precision (16 bits) .~~3.14
32 @rs single precision (32 bits) .6.022141e23
33 @rd double precision (64 bits) .~6.02214085774e23
34 @rq quad precision (128 bits) .~~~6.02214085774e23
35@s signed integer, sign bit low
36 @sb signed binary --0b11.1000
37 @sd signed decimal --1.000.056
38 @sv signed base32 -0v1df64.49beg
39 @sw signed base64 --0wbnC.8haTg
40 @sx signed hexadecimal -0x5f5.e138
41@t UTF-8 text (cord) 'howdy'
42 @ta ASCII text (knot) ~.howdy
43 @tas ASCII text symbol (term) %howdy
44@u unsigned integer
45 @ub unsigned binary 0b11.1000
46 @ud unsigned decimal 1.000.056
47 @uv unsigned base32 0v1df64.49beg
48 @uw unsigned base64 0wbnC.8haTg
49 @ux unsigned hexadecimal 0x5f5.e138
50```
52### Bitwidth
54Capital letters at the end of auras indicate the bitwidth in binary powers of
55two, starting from A.
57```
58 @udD unsigned single-byte (8-bit) decimal
59 @tD 8-bit ASCII text
60 @rhE half-precision (16-bit) floating-point number
61 @uxG unsigned 64-bit hexadecimal
62 @uvJ unsigned, 512-bit integer (frequently used for entropy)
63```
65### Nesting
67A given aura nests under any aura whose name is a substring or extension of the
68given aura:
69```
70> :- (~(nest ut [%atom %ud ~]) | [%atom %u ~])
71 (~(nest ut [%atom %ud ~]) | [%atom %udx ~])
72[%.y %.y]
73```
74but does not nest "sideways":
75```
76> (~(nest ut [%atom %ud ~]) | [%atom %ux ~])
77%.n
78```
79We call auras "soft types" since this nesting behavior can be ignored. Auras are
80non-coercive, but conversions may have to go via the empty aura, e.g.
81```
82> ^-(@ud ^-(@ 'foo'))
837.303.014
84```
85This is implicitly done by the irregular form of `^-`.
86```
87> `@ud`'foo'
887.303.014
89```
91### Bunting
93The bunt value for all auras is 0 except for `@da`.
94```
95> *@da
96~2000.1.1
97```
98A bunt value of 0 is helpful when working with loobeans.