Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



I also was interested in the answer to this, which turns out to be here:

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.


It'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.


Thanks! I'll try to join their slack after work :)




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: