FYI any Windows users out there: https://docs.microsoft.com/en-us/windows/dev-environment/overview
My riff off of <https://twitter.com/grady_booch/status/1288947573277855744|Grady Booch’s post> :)
Hmm… I think I like this one better …
lol - someone in my local slack asked me why I didn’t just compare the lower order bit to 0
:slightly_smiling_face: Wow…
I replied, “that would be too slow”, and the conversation continued :slightly_smiling_face:
I genuinely laughed when I got the the last line of code there
yeah, definitely part of the charm :slightly_smiling_face:
I considered using is-even?
in the last line, but I didn’t have time.
Turns out it is faster to check the lower order bit for 0
! (last one, I promise!)
BTW - I tried using (curry bitwise-and 1)
but that resulted in a contract violation from curry
- I fixed it by using ((curry bitwise-and 1))
but that was less than satisfying.
Sorry, but I just discovered peano numbers, so I had to code a version with those. It’s Friday, we’re in a pandemic, and the channel isn’t super busy, so …
Church encoding next?
Finished my afternoon coffee, so no :)
lol
FWIW, Racket supports peano number almost out of the box.
(define quote add1)
''''0 ; => 4
I need to let others have some of the fun. I set the bar low enough :-o