6 ms·
From OP: One obstacle to learning Hoon is that it has two quite distinct concepts that might equally be called a "type." Worse, most other typed functional lan
by urbit 11y ago
From OP:
One obstacle to learning Hoon is that it has two quite distinct concepts that might equally be called a "type." Worse, most other typed functional languages are mathy and share a basically mathematical concept of "type." Hoon does not have this concept at all.
It'd be useful to hear what's unclear about this.
- Avshalom 11y agoKinda giving away the game there.
- morsch 11y agoAll of that is unclear: The two distinct concepts are only (very opaquely) introduced in the next paragraph. The reference to the mathy concept of type in other FP languages is vague (basically incomprehensible to me). Consequently the final sentence carries very little information; the reference ("this") is also ambiguous. I'd drop the quoted text and maybe the entire section ("A type system for nouns"), alternatively, move it down a few sections. I understood the examples for the most part. I still have no idea at all what a mold is.
- urbit 11y agoHappy to take PRs if you feel you can write it better. One of these paragraphs has to come before the other. "Mathy" probably should have a link to https://en.wikipedia.org/wiki/Type_theory https://en.wikipedia.org/wiki/Type_theory. My experience is that if you say "type" in the context of functional programming, people expect Bertrand Russell and have a right to expect Bertrand Russell. We're not delivering Bertrand Russell, so it would seem like false advertising. A mold is a function whose range is some useful span. A mold is always idempotent (for any noun x, f(x) equals f(f(x))), and its domain is any noun. I stared at this for a moment but was unable to make it any clearer. Suppose your span is the set of all cells. A mold for this span is a function that maps any cell to itself, and any atom to a trivial cell like [0 0]. Does that help?
- morsch 11y agoThe definition of a mold is clear (to anyone who has had higher education in mathematics, which seems a prerequisite for this introduction). What I don't have is any intuition about what a mold is. The example helps a little. The tutorial seems to have another example of a mold in the final section, but I'm only guessing so because of that section's title. I'll be damned if I can tell where the mold is in that section and I cannot relate it at all to the example in your comment.
- urbit 11y agoFrom OP, in the section "Our first mold": After seeing a few span examples, are we ready to describe the set of all spans with a Hoon mold? Well, no, but let's try it anyway. Ignore the syntax (which we'll explain later; this is a tutorial, not a reference manual), and you'll get the idea: ++ span $% [%atom p=@tas] [%cell p=span q=span] [%cube p=* q=span] == This mold is not the entire definition of a Hoon span, just the cases we've seen so far. In English, a valid span is either: - a cell with head `%atom`, and tail some symbol. - a cell with head `%cell`, and tail some pair of spans. - a cell with head `%cube`, and tail a noun-span pair. I do think this is clear enough. I'm not sure it's intuitive enough. The following chapters should help with that; sorry.
- evanpw 11y agoBut is this a representation of a mold or span? It seems to describe a set rather than define a function, so the latter seems more likely, but the section header implies otherwise.
- urbit 11y agoThat's pretty much what a mold is. The syntax is written to look as much as possible like the description of a set, but the semantics are that you're actually defining a function.
- evanpw 11y ago> A mold is a function whose range is some useful span. A mold is always idempotent (for any noun x, f(x) equals f(f(x))), and its domain is any noun. I think using the magic word "projection" would make this clearer. Basically, a span is a set of nouns concretely defined by a projection operator ("mold") on the set of all nouns, right?