Piping and Function Composition Equivalence
had a divine revelation. want to write a pipe f, e.g. pipe(x,f,g):=g(f(x)). but there's also f composition, pipe(x,f,g) == fc(f,g)(x). no want do both, cuz seems redundant, and pipe is far more useful. thought for 1 hour, n found an answer that's mathematically sane!
the math sane answer is, just write a f composition function. Allow each argument to be a non-function e.g. 3. treat them as constant function, e.g. 3 is a function that always returns 3. This way, pipe(x,f,g) is same as func_compose(x,f,g). #haskell #ocaml #clojure
treating data (such as number) as (constant) function is a powerful idea. Because it lets you treat function and data in a uniform way.
Unix Pipe, Dot Notation, Postfix Notation
- OOP Dot Notation, Dot Before Data or After?
- OOP Dot Notation, is Object Data or Namespace?
- Unix Pipe as Functional Language
- Method Chaining, Postfix Operator, and OOP
- Ontology of Postfix Notation, Method Chaining, and Unix Pipe
- Piping and Function Composition Equivalence
If you have a question, put $5 at patreon and message me.