Combinators (tinyapl.rubenverg.com)

by tosh 41 comments 154 points
Read article View on HN

41 comments

[−] siruwastaken 45d ago
Could somebody provide a bit of context on what exactly this is? It seems interesting, but I have no idea what I am looking at.
[−] gregfjohnson 45d ago
(Show HN?) There is a deep and lovely connection between the Y-combinator and the classic version of Godel's incompleteness theorem: https://gregfjohnson.com/incompleteness/
[−] tromp 45d ago
The notation used seems rather confusing, not even showing the list of arguments. For example, the argument swapping combinator C which is normally defined as

    C f x y = f y x
is shown on this page as as y F x, which I can only make sense of by assuming that F is an infix function. In Haskell you could use infix notation to define

    C f x y = y `f` x
but you can't use capitalize function arguments.
[−] rdevilla 45d ago
I wish universal and eternal patterns like this were studied more often in software engineering. Perhaps we would have a chance in hell of finding canonical representations of common structures and even programs instead of basket weaving majors fucking reinventing the wheel every 5 minutes with yet another half-baked poorly understood Python or JavaScript instantiation of a common pattern. Imagine still writing for loops and munging indices instead of expressing things in terms of higher order functions like folds or maps...

Eh, I don't need to imagine; we're still stuck at that same level of infantilism. Instead of actually graduating to higher order atoms and primitives of thought though, we can just have the AI slop out another 100k LOC. Then the system will have so much incidental complexity that it becomes impossible to distill out its essence, because there no longer is one.

[−] Trung0246 45d ago
Wikipedia have a pretty good Z combinator demo: https://en.wikipedia.org/wiki/Fixed-point_combinator

---

const K = (a: A) => (_b: B) => a; const S = (a: (x: C) => (y: B) => A) => (b: (x: C) => B) => (c: C) => a(c)(b(c));

const I = S(K)(K); const B = S(K(S))(K); const C = S(B(B)(S))(K(K)); const W = C(S)(I); const T = C(I); const V = B(C)(T); const I1 = C(C(I)); const C1 = B(C); const R1 = C1(C1); const V1 = B(R1)(C1); const I2 = R1(V);

const Z = B(W(I1))(V1(B)(W(I2)));

[−] pklausler 45d ago
The logical combinators that I know all have definitions in the untyped lambda calculus. Is there a typed variant of logical combinators?
[−] gbell12 44d ago
Gabriel Lebec's "Flock of Functions" video is a great explanation https://www.youtube.com/watch?v=3VQ382QG-y4
[−] ux266478 45d ago
A bit of an aside: I wonder how much array-oriented languages like APL and J would benefit from being implemented on top of an interaction net machine?
[−] vednig 44d ago
Thinking of starting a K, S and Z combinator since Y one is already taken
[−] worldsayshi 45d ago
Does anyone have a grasp of how this relates to interaction nets?
[−] cat-whisperer 45d ago
omega and y are missing buddy! I was so looking forward to having them represented in APL
[−] notmarkeloff 44d ago
[dead]
[−] hrmtst93837 45d ago
[flagged]