-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These changes introduce a jet for the [`+mate` arm](https://developers.urbit.org/reference/hoon/stdlib/2a#mate), and were tested with the following commands: ``` > (mate ~ ~) ~ > (mate ~ `1) [~ u=1] > (mate `2 ~) [~ u=2] > (mate `3 `3) [~ u=3] > (mate `4 `5) (error) took ms/2.118 > ~> %bout (roll (gulf 1 1.000) |=([n=@ a=(unit @)] (mate (mate `n ~) (mate ~ `n)))) [~ 1.000] > =hoon-mate |*([a=(unit) b=(unit)] ?~(b a ?~(a b ?.(=(u.a u.b) ~>(%mean.'mate' !!) a)))) took ms/4.603 > ~> %bout (roll (gulf 1 1.000) |=([n=@ a=(unit @)] (hoon-mate (hoon-mate `n ~) (hoon-mate ~ `n)))) [~ 1.000] ``` The `+mate` error text (`bail: fail` followed by stack trace) looks different from the `+need` error text (`dojo: hoon expression failed`) despite using the same jet error routine (i.e. `u3m_bail(c3__fail)`). Feedback on this would be appreciated!
- Loading branch information
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// @file | ||
|
||
#include "jets/q.h" | ||
#include "jets/w.h" | ||
|
||
#include "noun.h" | ||
|
||
|
||
u3_noun | ||
u3qb_mate(u3_noun a, | ||
u3_noun b) | ||
{ | ||
if ( u3_nul == b ) { | ||
return u3k(a); | ||
} else if ( u3_nul == a ) { | ||
return u3k(b); | ||
} else if ( c3y == u3r_sing(u3t(a), u3t(b)) ) { | ||
return u3k(a); | ||
} else { | ||
return u3m_error("mate"); | ||
} | ||
} | ||
u3_noun | ||
u3wb_mate(u3_noun cor) | ||
{ | ||
u3_noun a, b; | ||
u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); | ||
return u3qb_mate(a, b); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters