4 ms·
Interesting, I tried to convert Z combinator in SKI to this using the lambda calculus example then print out the tree. Untested: z = (t (t (t t (t (t (t (t
by Trung0246 2y ago
Interesting, I tried to convert Z combinator in SKI to this using the lambda calculus example then print out the tree. Untested:
z = (t (t (t t (t (t (t (t (t t (t (t (t (t (t t)) (t t))) (t (t (t t)) (t t))))) (t (t (t t (t (t (t t (t (t (t t t)) t))) (t t)))) (t (t (t t (t (t (t (t (t t)) (t t)))))) (t t))))) (t t (t (t (t (t (t t))))))))) (t (t (t (t (t t (t (t (t (t (t t (t (t (t t (t (t (t t t)) t))) (t t)))) (t (t (t t t)) t))) (t t (t t))))) (t (t (t t (t (t (t (t (t t (t (t (t t (t (t (t t t)) t))) (t t)))) (t (t (t t t)) t))) (t t (t t))))) (t (t (t t (t (t (t t t)) t))) (t t))))) (t t (t (t (t (t (t t (t (t (t (t (t t)) (t t))) (t (t (t t)) (t t))))) (t (t (t t (t (t (t t (t (t (t t t)) t))) (t t)))) (t (t (t t (t (t (t (t (t t)) (t t)))))) (t t))))) (t t (t (t (t t (t (t (t (t (t t (t (t (t (t (t t (t (t (t t (t (t (t t t)) t))) (t t)))) (t (t (t t t)) t))) (t t (t t))))) (t (t (t t (t (t (t (t (t t (t (t (t t (t (t (t t t)) t))) (t t)))) (t (t (t t t)) t))) (t t (t t))))) (t (t (t t (t (t (t (t (t t)) (t t)))))) (t t)))))))) (t t)))))))
Original tested but unoptimized and also converted using tool:
var K = a => b => a;
var S = a => b => c => a(c)(b(c));
var Z = S(K(S(S(K(S(S(K)(K))(S(K)(K))))(S(K(S(K(S))(K)))(S(K(S(S(K)(K))))(K))))(K(S(S(K))))))(S(S(K(S(S(K(S(K(S))(K)))(S))(K(K))))(S(K(S(S(K(S(K(S))(K)))(S))(K(K))))(S(K(S))(K))))(K(S(S(K(S(S(K)(K))(S(K)(K))))(S(K(S(K(S))(K)))(S(K(S(S(K)(K))))(K))))(K(S(K(S(S(K(S(S(K(S(K(S))(K)))(S))(K(K))))(S(K(S(S(K(S(K(S))(K)))(S))(K(K))))(S(K(S(S(K)(K))))(K))))))(K))))));
https://en.wikipedia.org/wiki/Fixed-point_combinator https://en.wikipedia.org/wiki/Fixed-point_combinator
- october8140 2y agoThis code is so easy to read.
- idle_zealot 2y agoYeah, I think I'm going to take the author's advice and use Tree Calculus to generate JSON config files. That way I won't need to use a bloated tool with a JSON parser just to output configuration.
- ktm5j 2y agoNo kidding.. I didn't think parenthesis hell could get worse than Lisp
- shiandow 2y agoWell really this language just takes the next logical step by removing all but a single symbol. The next one would be () = t, to finally get a language consisting solely of parentheses.
- Tainnor 2y agoAny source code in any programming language can in theory be encoded in unary, requiring only a single symbol (and without any need for extra grouping or whitespace). It's not gonna be efficient, though.
- scotty79 2y agoIt's equivalent to binary machine code for a procesor with 5 opcodes. Why would it be readable?
- tromp 2y agoZ = \f. (\x. f (\v. x x v)) (\x. f (\v. x x v)) can be much simpler, namely S (S (K (S S (K (S (S K K) (S K K))))) K) (S (K (S S (K (S (S K K) (S K K))))) K)
- Trung0246 2y agoIf you means that it would be like this: var Z = S(S(K(S(S)(K(S(S(K)(K))(S(K)(K))))))(K))(S(K(S(S)(K(S(S(K)(K))(S(K)(K))))))(K)); Unfortunately not works with the `count_fn` function from the wikipedia page :(, `too much recursion`.