News for hackers. Stuff that matters.

wrbs

There's nothing about the lambda calculus which forces you to use the church encoding of natural numbers.

You could also come up with an encoding based on booleans as bits:

  {true} = \t f. t
  {false} = \t f. f
then bytes:

  {0b00001111} = \f. f [false] [false] [false] [false] [true] [true] [true] [true]
which you could merge up into larger integers just like real computers.

or for one less based on the 8-bits and to keep the infinite range you could just represent integers as lists of binary numbers:

  {[]} = \c n. n
  {x::y} = \c n. c x y

  {0} = []
  {1} = [true]
  {2} = [false, true] (i.e. reversed 0b10)
  {3} = [true, true]
  {4} = [false, false, true]
which you could imagine using to implement a way more efficient shift-and-add multiply, O(log M * log N)
Re:Show HN: I may have created a new type of puzzle on Sunday September 18, 2022 @08:05AM (#32886835)
Got the same.

There are 200 ways of doing this (if you don't distinguish between the 2 bunnies when they're on the same tile, 420 if you do).

If you merge together moves involving the same animal there are only 4 (with length 15).

https://gist.github.com/wrbs/5824e9b17c55b5ad3d8467f93e12ed8... (svg graph of the 4)