urbit/pub/docs/dev/hoon/runes/wt/wtkt.md
Galen Wolfe-Pauly bb495844be doc -> docs
2015-10-20 10:51:45 -07:00

1.0 KiB

wutket, ?^, %wtkt

Is bunt, inverse

?^ is a synthetic rune that evaluates r if p is equal to the bunt for its tile, otherwise q is evaluated.

Produces

Twig: [%wtkt p=wing q=twig r=twig]

Sample

p is a ++wing. q and r are twigs.

Tall form

?^  p
  q
r

Wide form

?^(p q r)

Irregular form

None

Examples

~zod/try=> =(*@tas "")
%.y
~zod/try=> ?^  ""
             %full
           %empty
%empty
~zod/try=> ?^  "asd"
             %full
           %empty
%full

Here we show that *@tas, the bunt of @tas is equivalent to the empty ++tape "", then use it in two ?^ cases.

~zod/try=> *(unit)
~
~zod/try=> ?^  `(unit)`~
             %full
           %empty
%empty
~zod/try=> ?^  `(unit)`[~ u=20]
             %full
           %empty
%full

Similar to the above case, we show the bunt of a ++unit, which is ~, and test against it.