Wild ! ('zap')

    Runes

    !> "zapgar"

    [%zpgr p=hoon]: wrap a noun in its type.

    Produces

    A cell whose tail is the product of p, and whose head is the static type of p.

    Syntax

    Regular: 1-fixed.

    Discussion

    In Hoon, a dynamic type is a static type compiled at runtime. This type-noun cell is generally called a vase.

    Examples
    > !>(1)
    [#t/@ud q=1]
    

    If you want just the type value, use a 'type spear'. This is -:!>, i.e., the head of the cell produced by !>:

    > -:!>(1)
    #t/@ud
    

    !: "zapcol"

    [%dbug p=hoon]: turn on stack trace

    Produces

    The product of p unless p crashes, in which case a stack trace is given.

    Syntax

    Regular: 1-fixed.

    !:  p=hoon
    
    Discussion

    !: is used to turn on a debugging stack trace option for any code you have in p.

    Examples
    > ?:(=(0 1) 123 !!)
    ford: %ride failed to execute:
    
    > !:  ?:(=(0 1) 123 !!)
    /~zod/home/~2018.10.15..19.50.06..74af:<[1 5].[1 22]>
    /~zod/home/~2018.10.15..19.50.06..74af:<[1 19].[1 21]>
    ford: %ride failed to execute:
    

    !. "zapdot"

    Turn off stack trace for a subexpression p

    Produces

    The product of p. If p crashes, no stack trace entries are given for that code.

    Syntax

    Regular: 1-fixed.

    !.  p=hoon
    

    p is any Hoon expression.

    Discussion

    !. is used to turn off a debugging stack trace option for any code you have in p. This rune can be embedded under a !: rune for inner loops of your code that you don't want or need to trace. This is especially useful if a trace overflows the stack.

    Examples
    > %.(1 |=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a))))))
    ford: %ride failed to execute:
    
    > !:  %.(1 |=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a))))))
    /~zod/home/~2018.10.15..20.01.21..6b0c:<[1 5].[1 49]>
    /~zod/home/~2018.10.15..20.01.21..6b0c:<[1 17].[1 47]>
    /~zod/home/~2018.10.15..20.01.21..6b0c:<[1 22].[1 46]>
    /~zod/home/~2018.10.15..20.01.21..6b0c:<[1 36].[1 45]>
    ...skipping some lines...
    /~zod/home/~2018.10.15..20.01.21..6b0c:<[1 17].[1 47]>
    /~zod/home/~2018.10.15..20.01.21..6b0c:<[1 22].[1 46]>
    /~zod/home/~2018.10.15..20.01.21..6b0c:<[1 33].[1 35]>
    ford: %ride failed to execute:
    
    > !:  %.(1 !.(|=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a)))))))
    /~zod/home/~2018.10.15..20.01.35..0529:<[1 5].[1 53]>
    ford: %ride failed to execute:
    

    != "zaptis"

    [%zpts p=hoon]: make the Nock formula for a Hoon expression.

    Produces

    The Nock generated by p.

    Syntax

    Regular: 1-fixed.

    Discussion

    Don't confuse != with a negation, !, followed by a test for equality, =(10 11).

    Examples
    > !=(20)
    [1 20]
    
    > !=(~zod)
    [1 0]
    
    > !=((add 2 2))
    [8 [9 3.110.356 0 31] 9 2 [0 4] [7 [0 3] 1 2 2] 0 11]
    

    Don't confuse the != rune with:

    > !=(10 11)
    %.y
    
    > !=(10 10)
    %.n
    

    The syntax difference is that a test for equality takes two subexpressions, and the != rune only one.

    !? "zapwut"

    [%zpwt p=@ q=hoon]: restrict Hoon version.

    Produces

    q, if p is greater than or equal to the Hoon kelvin version. (Versions count down; the current version is 141.)

    Syntax

    Regular: 2-fixed.

    Examples
    > !?(264 (add 2 2))
    4
    
    > !?(164 (add 2 2))
    4
    
    > !?(64 (add 2 2))
    ! exit
    

    !! "zapzap"

    [%zpzp ~]: crash.

    Produces

    Nothing. Always crashes, with type %void.

    Syntax

    !!

    Discussion

    %void nests in every other type, so you can stub out anything with !!.

    Examples
    > !!
    ford: build failed