urbit / urbit.org

The source for urbit.org
https://urbit.org
MIT License
93 stars 197 forks source link

!, undocumented #989

Closed drbeefsupreme closed 2 years ago

drbeefsupreme commented 4 years ago

This is absent from the page on zap runes.

Some information from the infrastructure channel, courtesy of @belisarius222

~rovnys-ricfer= it's a rune                                            ~17.25.20
~rovnys-ricfer= it produces the result of parsing a hoon expression    ~17.25.47
~rovnys-ricfer= it takes two args: the first arg should be *hoon, and  ~17.26.27
                the second is the expression to parse
~rovnys-ricfer= I'm not sure we use it anywhere in production, but     ~17.26.54
                it's useful for understanding the hoon compiler
~rovnys-ricfer= the first arg is there for staging upgrades to the     ~17.28.04
                language itself, I believe; the expansion for !> has a
                *type in there for similar reasons, if I recall
~rovnys-ricfer# !,  *hoon  %foo                                        ~17.28.33
                [%rock p=%tas q=7.303.014]
~rovnys-ricfer= oops                                                   ~17.30.31
~rovnys-ricfer# !,  *hoon  (add 2 3)                                   ~17.30.40
               _[%cncl p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%sand p=%ud q=3]]]
~rovnys-ricfer= so you can see that macro-expands to %:(add 2 3)       ~17.31.39
~rovnys-ricfer= %: says call a function with a list of arguments       ~17.31.55
~rovnys-ricfer= with the !, and != runes, you can reverse engineer     ~17.33.49
                quite a bit of the hoon compiler
~rovnys-ricfer# !=  (add 2 3)                                          ~17.34.04
               _[8 [9 36 0 1.023] 9 2 10 [6 [7 [0 3] 1 2] 7 [0 3] 1 3]
~rovnys-ricfer= which means something like =+  add  %:(- 2 3)          ~17.34.54
~rovnys-ricfer= where '-' there means 'take the head of the subject'   ~17.35.11
~rovnys-ricfer= [8 ... [9 2 ...] [0 2]] means 'pin a new gate to the   ~17.36.26
                head of the subject, then call it'
~rovnys-ricfer= [9 36 0 1.023] calls the +add arm from the standard    ~17.37.02
                library, which produces the add gate
~rovnys-ricfer= [10 [6 ...]] means 'swap out the default sample with   ~17.37.24
                the actual argument'
~rovnys-ricfer= and you can see [1 2] and [1 3] in there, which are    ~17.38.13
                the constants 2 and 3
ohAitch commented 4 years ago

If we're making this more official, should we have a biblical for ++hoon? It's already exposed in the type type

On Fri, Apr 3, 2020 at 10:35, poprox notifications@github.com wrote:

This is absent from the page on zap runes.

Some information from the infrastructure channel, courtesy of @belisarius222 https://github.com/belisarius222

~rovnys-ricfer= it's a rune ~17.25.20 ~rovnys-ricfer= it produces the result of parsing a hoon expression ~17.25.47 ~rovnys-ricfer= it takes two args: the first arg should be hoon, and ~17.26.27 the second is the expression to parse ~rovnys-ricfer= I'm not sure we use it anywhere in production, but ~17.26.54 it's useful for understanding the hoon compiler ~rovnys-ricfer= the first arg is there for staging upgrades to the ~17.28.04 language itself, I believe; the expansion for !> has a type in there for similar reasons, if I recall ~rovnys-ricfer# !, hoon %foo ~17.28.33 [%rock p=%tas q=7.303.014] ~rovnys-ricfer= oops ~17.30.31 ~rovnys-ricfer# !, hoon (add 2 3) ~17.30.40 _[%cncl p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%san ~rovnys-ricfer= so you can see that macro-expands to %:(add 2 3) ~17.31.39 ~rovnys-ricfer= %: says call a function with a list of arguments ~17.31.55

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/urbit/docs/issues/839, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOFPBRE5A5DQTQFC6LZE43RKYM5JANCNFSM4L4J7QMQ .