Skip to content
This repository has been archived by the owner on Jan 9, 2021. It is now read-only.

Changes based on Hoon style feedback from Fang #52

Merged
merged 1 commit into from
Aug 30, 2019

Conversation

mattnewport
Copy link
Contributor

@Fang- Changes based on your style feedback.

I'm not sure I fully understand why (~(all in chars) ~(has by table)) works - something for me to figure out in Hoon 201...

Copy link
Member

@Fang- Fang- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you! (:

~(has by table) gets the has arm from the by core initialized with the table argument. has itself is a gate, and all takes a gate as an argument, so we can just slot that in. all then takes care of calling has in the same way you were doing in your custom gate before.

@Fang- Fang- merged commit fb4c5ef into urbit:master Aug 30, 2019
@mattnewport
Copy link
Contributor Author

mattnewport commented Aug 30, 2019

Looks good, thank you! (:

~(has by table) gets the has arm from the by core initialized with the table argument. has itself is a gate, and all takes a gate as an argument, so we can just slot that in. all then takes care of calling has in the same way you were doing in your custom gate before.

I didn't really grok the ~(all in chars) %~ syntax before, I was just following the examples in the docs without thinking too hard about it. I was thinking of all as a gate in in taking two args, a set chars and a gate predicate. Then I was looking at it again and thinking there was some kind of currying going on where I was getting a gate with the chars argument bound.

So what I think I get is going on now is that ~(all in chars) is getting the in core with chars bound as a sample to the core and then getting the all arm in that which is just a gate that expects another gate as an argument. Then ~(has by table) is giving me the by core with the table map bound to it and fetching the has arm, which is just another gate suitable for passing as the sample. It's a little like currying in that you're binding an argument but it's being bound to the in core not the all gate.

Before I couldn't understand why I couldn't do ~(all in chars ~(has by table)) but I think I get it now.

@Fang-
Copy link
Member

Fang- commented Aug 30, 2019

Yeah, that understanding is correct! (:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants