Skip to content

Conversation

@jackfoxy
Copy link

@jackfoxy jackfoxy commented Jan 6, 2026

Add example to tree addressing peg doc using dig by to calculate address in (map (map).

@jackfoxy
Copy link
Author

jackfoxy commented Jan 6, 2026

@sigilante @dozreg-toplud

@dozreg-toplud
Copy link
Contributor

@jackfoxy,
I don't think this is a good example: outer/inner etc. are not defined, and +dig:by is two chapters later in hoon.hoon than +peg.

What would you like the example to show/explain? If it was up to me I would try to demonstrate that +peg is associative and +1 is an identity. The latter is already demonstrated, and the former isn't really. Also another example of +peg/+cap interaction wouldn't hurt.

@jackfoxy
Copy link
Author

jackfoxy commented Jan 6, 2026

This is the exact use case that got me involved with this.
No double-hashing, no key comparisons, just hops to an index in a mip using dottar (.*).
This works when you have 100K mips all with the same index structure.
This is a practical application of peg.
Pretty sure I've seen precedence for examples that are not fully expanded (so long as they are comprehensible) and most people use the docs as a reference, not as a book.
I dunno. IMO expanding the example would make it harder to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants