jcoo092
2020-7-31 07:28:00

badkins
2020-7-31 15:01:42

My riff off of <https://twitter.com/grady_booch/status/1288947573277855744|Grady Booch’s post> :)


badkins
2020-7-31 15:13:38

Hmm… I think I like this one better …


badkins
2020-7-31 15:26:58

lol - someone in my local slack asked me why I didn’t just compare the lower order bit to 0 :slightly_smiling_face: Wow…


badkins
2020-7-31 15:27:29

I replied, “that would be too slow”, and the conversation continued :slightly_smiling_face:


samth
2020-7-31 15:28:05

I genuinely laughed when I got the the last line of code there


badkins
2020-7-31 15:46:52

yeah, definitely part of the charm :slightly_smiling_face:


badkins
2020-7-31 15:48:16

I considered using is-even? in the last line, but I didn’t have time.


badkins
2020-7-31 16:08:29

Turns out it is faster to check the lower order bit for 0 ! (last one, I promise!)


badkins
2020-7-31 16:14:26

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.


sorawee
2020-7-31 16:17:33

I’m hoping for a solution that uses https://docs.racket-lang.org/2d/



badkins
2020-7-31 18:20:13

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 …


sorawee
2020-7-31 18:24:15

Church encoding next?


badkins
2020-7-31 18:24:35

Finished my afternoon coffee, so no :)


sorawee
2020-7-31 18:24:54

lol


sorawee
2020-7-31 18:25:15

FWIW, Racket supports peano number almost out of the box.


sorawee
2020-7-31 18:25:31

(define quote add1) ''''0 ; =&gt; 4


badkins
2020-7-31 18:26:43

I need to let others have some of the fun. I set the bar low enough :-o