35 ms·
This already exists to some extent, with the >> operator and lambdas. ``` first = ->(x){some code...} second = ->(x){some code...} third = ->(x){some code..
by supernikio2 3y ago
This already exists to some extent, with the >> operator and lambdas.
```
first = ->(x){some code...}
second = ->(x){some code...}
third = ->(x){some code...}
(third >> second >> first).call(arg)
```
I agree it's not as clean as what you propose, but much better imo than traditional nested calls (and Haskell's `.`).
- ljm 3y agoI’ve had a lot of fun with Ruby’s support for functional paradigms but that stuff is unlikely to get through code review when the status quo tends towards ‘Clean Code’ style OOP over-abstraction. Ruby being a type 2 lisp is a fun one - creating a class and and a factory function with the same name, with argument forwarding: class Animal; …; end def Animal(…); Animal.new(…); end