urbit / urbit.org

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

Various $ buc runes undocumented #948

Closed Fang- closed 3 years ago

Fang- commented 5 years ago

I only learned about these today, so instead have some words by @joemfb:

=/  all  $%([%0 @] [%1 ^])
$&(all |=(a=all ?-(-.a %0 [%1 1 +.a], %1 a)))

That mold casts/bunts to [%1 ^], but also normalizes from [%0 @] if called on such a noun. It's $&(combined-mold normalizing-gate).

+$  old  [%0 @]
+$  new  [%1 ^]
+$  combined  $%(old new)
+$  adapting  $&(combined |=(=combined ...))

$| lets you call a validator, see +map

$> and $< lets you restrict some pre-existing mold see the vane interfaces in %zuse

and then a bunch of core interface stuff idk if that works

drbeefsupreme commented 5 years ago

I'm going to be documenting Ford runes today, so I'll take care of this as well.

drbeefsupreme commented 5 years ago

I spoke to @joemfb about this to get an idea of how I might figure out what these runes do, and the task turns out to be more involved than what I have time to focus on this week allows for, so this will probably sit for awhile before I get to it.

drbeefsupreme commented 4 years ago

I'm finally getting back around to this. I refreshed my list of all the buc runes in hoon.hoon that are currently undocumented:

$&, $|, $$, $., $+, $/, $;, $`, and $!. I was planning on grepping around to see how much they're used to decide priority, but if anyone has comments on which of these would be more useful to do first please speak up. I was planning on handling $& and $| first since they're in the OP.

joemfb commented 4 years ago

Several of those are only partially implemented in the $spec engine, or not even exposed in the parser. I'd say it's fine to leave them undocumented if we're not using them anywhere.

drbeefsupreme commented 4 years ago

So this seems mostly handled by these PR's:

https://github.com/urbit/docs/pull/809 - bucgar and bucgal https://github.com/urbit/docs/pull/884 - bucbar

And I'm mostly finished with bucpam $& but I'm having some trouble with the example code. In dojo:

> =old [%0 @]
> =new [%1 ^]
> =combined $%(old new)
> =adapting $&(combined |=(a=combined ?-(-.a %0 [%1 1 +.a], %1 a)))
/~zod/home/~2020.5.28..03.34.46..eb2b/sys/vane/ford:<[4.822 18].[4.822 59]>
-lost.?(@ {* *})
mint-lost
ford: %slim failed: 
ford: %ride failed to compute type:

According to the docs on ?-, a mint-lost error here means that not all cases are covered. But they are? What am I doing wrong? @Fang-

I was able to get it to work fine with ?^ instead, but ?- is clearly the correct rune to use with $& most of the time.

ohAitch commented 4 years ago

Note that =old and =new are values not types, so when you call them as types (gates) you effectively get just @ from [0 @] and ^ from [1 ^], or in $% effectively "noun"

On Thu, May 28, 2020 at 12:28, poprox notifications@github.com wrote:

So this seems mostly handled by these PR's:

urbit/docs#809 https://github.com/urbit/docs/pull/809 - bucgar and bucgal urbit/docs#884 https://github.com/urbit/docs/pull/884 - bucbar

And I'm mostly finished with bucpam $& but I'm having some trouble with the example code. In dojo:

=old [%0 @] =new [%1 ^] =combined $%(old new) =adapting $&(combined |=(a=combined ?-(-.a %0 [%1 1 +.a], %1 a))) /~zod/home/~2020.5.28..03.34.46..eb2b/sys/vane/ford:<[4.822 18].[4.822 59]> -lost.?(@ { }) mint-lost ford: %slim failed: ford: %ride failed to compute type:

According to the docs on ?-, a mint-lost error here means that not all cases are covered. But they are? What am I doing wrong? @Fang- https://github.com/Fang-

I was able to get it to work fine with ?^ instead, but ?- is clearly the correct rune to use with $& most of the time.

— 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/687#issuecomment-635549713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOFPBSSOTP3Z2C33ZDZMSDRT23PJANCNFSM4JGBRN2A .

ohAitch commented 4 years ago

I forget if we have an official rune for "I want to be in type syntax now", I think I'd use =old ?([%0 @]) =new ?([%1 ^])

Fang- commented 4 years ago

I forget if we have an official rune for "I want to be in type syntax now"

You can toggle parsing mode with ,. idk what rune that's shorthand for, can't find it with a quick look around hoon.hoon.

ohAitch commented 4 years ago

Presumably $, for at least one of those directions…

drbeefsupreme commented 3 years ago

$~ and $^ are also missing

drbeefsupreme commented 3 years ago

$| is finally merged. I believe that covers all of the ones mentioned as being important here.