News for hackers. Stuff that matters.
Re:Turnstyle – An esoteric, graphical functional language by drdeca on Wednesday August 21, 2024 @10:34PM (#41316266)
This seems cool, but I’m having difficulty understanding the specification. It would be nice if there were some examples of e.g. 2+3 , (lambda f. lambda x. (f (f x)))(lambda y. (y+2)) 3 ?
Re:Turnstyle – An esoteric, graphical functional language by lifthrasiir on Thursday August 22, 2024 @12:08AM (#41316728)
`2 + 3` would be internally `((prim(3, 1) 2) 3)`, which can be composed of following fragments (where `^>v<` indicates the direction and the position of the current turnstile):

                        AA
    prim(3, 1):         >BBB
                        C

    literal 2:          AvB
                         CC

    literal 3:          AvB
                        CCC

                        A
    (prim(3,1) 2):      >*****prim(3,1)
                        *
                        *
                        2

                        A
    ((prim(3,1) 2) 3):  >*****(prim(3,1) 2)
                        *
                        *
                        3
So assuming that each distinct letter (including space, which is otherwise unused here) corresponds to a distinct color, one possible encoding would be:

     A    A    BB
    >>BBBBBCCCCCD
     B    C    AD
     B    C     D
    CBD  DCA
    AAA   BB
The specification allows for a simple "identity" pattern which can be used to extend otherwise overlapping patterns here. The following, if I did everything right, would be more compact but much harder to decipher:

    CADABB
    >>BBCD
    CBDCAD
    AAABBD