News for hackers. Stuff that matters.
Re:De Bruijn notation, and why it's useful by SkiFire13 on Friday May 30, 2025 @01:49PM (#44138471)
This implies that applying a function is no longer the same as a plain substitution. Moreover this can be pretty expensive computationally.
Re:De Bruijn notation, and why it's useful by guerrilla on Saturday May 31, 2025 @01:14AM (#44141993)
The semantics are the same for the user and debugging works, which is what matters. If you're using an object oriented language for implementation then this is already the computational cost. If you're using a functional language then yes there is some space overhead because it breaks sharing but that's the price. Was there something else you were thinking of?
Re:De Bruijn notation, and why it's useful by SkiFire13 on Saturday May 31, 2025 @06:37AM (#44143334)
It's not just space overhead, it requires you to recursively walk the argument of the application and replace all variables with fresh ones, once for every occurrence of the function argument. This means that function application is no longer O(size of the function) but rather O(size of the function + occurrences of the argument * size of the argument). If the size of the argument is big this makes the function application much much slower.
Re:De Bruijn notation, and why it's useful by wizzwizz4 on Saturday May 31, 2025 @06:28PM (#44147369)
It's not that expensive: just use De Bruijn notation under the hood. (I've seen a system that does this, and this is how it works.)
Re:De Bruijn notation, and why it's useful by SkiFire13 on Tuesday June 03, 2025 @12:52PM (#44172039)
But then the point of giving unique names to avoid using De Brujin indices is moot