3 ms·
Addressing your points individually: 1) On its own, Plumb is exactly an implementation of Lambda Calculus (like an extremely simplified form of Scheme or Haske
by chriswarbo 12y ago
Addressing your points individually:
1) On its own, Plumb is exactly an implementation of Lambda Calculus (like an extremely simplified form of Scheme or Haskell); its only novelty is its syntax, which makes it embeddable in scripting languages. It may be unfamiliar, but it's mainly useful for defining functions which shuffle their arguments around and pass them on to other functions.
2) Everything takes time to learn. Thankfully, Plumb has few rules, and they're applied consistently.
3) Nothing is "added", in the sense of Turing-completeness. Plumb is meant to work around awkward function-definition syntax. Some more sensible examples might be the following:
$compose = plumb([[[2 , __(1 , 0)]]]);
$z = plumb([[1, [1, 1, 0]],
[1, [1, 1, 0]]]);
These functions are really simple: compose functions and find a fixed-point. Compare them to raw PHP:
$compose = function($f, $g) { return function($x) use ($f, $g) { return $f($g($x)); }; };
$z = function($f) {
return call_user_func(function($x) use ($f) {
return $f(function($v) use ($x) {
return call_user_func($x($x), $v);
});
},
function($x) use ($f) {
return $f(function($v) use ($x) {
return call_user_func($x($x), $v);
});
});
};
I've also written a blog post which introduces Plumb incrementally, in the context of PHP: http://chriswarbo.net/posts/2014-08-18-edsl.html http://chriswarbo.net/posts/2014-08-18-edsl.html
- smt88 12y agoThanks for the response. "Compare them to raw PHP" -- that's exactly what I was looking for. This is theoretically interesting. As I suspected, though, I'm just not the right target audience. For the web backends I work on, I'm taking HTTP requests, manipulating inputs, mixing in values from a database, and then outputting the HTTP response. I've never had to write anything remotely like the PHP in your example. Maybe my life would be easier if I did, but at the moment, my biggest pain point (in code) is that ORM abstraction sucks, and there's no great alternative. That's not even in the same solar system as the problems you seem to be trying to solve.