Re:4B If Statements
by jrpelkonen on Thursday December 28, 2023 @06:18AM
(#38792296)
Implementing the comparisons by hand seems difficult and primitive. May I suggest introducing some helpful sub-packages and building the solution on top of those. For instance, is-odd would be implemented by using is-one, is-three, is-five, is-seven, etc.
[ Parent
| on HN ]
and is-one should be implemented by negating is-two, is-three, and so forth
I read some text where a cheme was implemented such that numbers were `2 = 1+1`, `3 = 2+ 1`...
Probably Peano numbers.
>Succ Peano
...
The standard joke about my university's grad-level programming languages course is that its formalization unit does a great job of identifying undergrads by discussing Peano naturals and Hoare logic in the same lecture...
Perhaps Nock:
https://developers.urbit.org/reference/nock/definition
> The reader might wonder how an interpreter whose only arithmetic operation is increment can ever be practical.
> The short answer is that a Nock interpreter doesn't have to use the algorithm above. It just has to get the same result as the algorithm above.