4 ms·
Do you know how they would hash a recursive function? Or where I can learn about this? Thanks! EDIT: I am asking more about the hashing function than about the
by efferifick 6y ago
Do you know how they would hash a recursive function? Or where I can learn about this? Thanks!
EDIT: I am asking more about the hashing function than about the language. Because if there is a recursive function, that means that one would need the hash of itself in order to compute its own hash. One can probably try to compute a hash iteratively until a fixed-point is achieved.
EDIT2: but... it is probably a bad idea to do that.
- roflc0ptic 6y agoIt's an interesting question that I don't have an answer to. I don't actually know what this technique is called - I heard about in passing at lambda conf, and just saw last week that Unison is using it. The unison crew is super friendly (Runar once patiently spent 20 minutes trying to explain adjunctions to me, a perfect stranger). I'll ask in their slack channel if this has a name.
- efferifick 6y agoThanks! I'll try to join their slack after work :)
- deleted 6y ago[deleted]
- dmurray 6y agoI also was interested in the answer to this, which turns out to be here: https://www.unisonweb.org/docs/faq/#how-does-hashing-work-for-mutually-recursive-definitions https://www.unisonweb.org/docs/faq/#how-does-hashing-work-fo... Tldr: A singly-recursive function works just fine: the current function has a name at hashing time which it can use to refer to itself. A set of mutually recursive functions gets hashed all together as a "cycle", and to refer to one of those functions you need the hash of the cycle plus an index representing which function in the cycle you want to call.