3 ms·
Ah! I just remembered I implemented some macros to simulate call by name in the TXR solution to the "Man or boy test" task on Rosetta Code: https://rosettacod
by kazinator 10y ago
Ah!
I just remembered I implemented some macros to simulate call by name in the TXR solution to the "Man or boy test" task on Rosetta Code:
https://rosettacode.org/wiki/Man_or_boy_test#TXR https://rosettacode.org/wiki/Man_or_boy_test#TXR
With these macros, Knuth's test is expressed exactly in the original form (modulo the Algol being cast into S-exp syntax).
Call by name isn't just lambda with funcall (as might be wrongly inferred from my comments in the other reply), because it supports assignment. If we pass a variable A with call by name, the caller can assign to it. This all works with the given macros, and it probably more or less corresponds to the Algol mechanisms.
(The task description is "Imitate Knuth's example in Algol 60 in another language, as far as possible." so the solutions which don't actually implement a call-by-name syntax and semantics don't go as far as this solution.)