Piping and Function Composition Equivalence

By Xah Lee. Date: .

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

  1. OOP Dot Notation, Dot Before Data or After?
  2. OOP Dot Notation, is Object Data or Namespace?
  3. Unix Pipe as Functional Language
  4. Method Chaining, Postfix Operator, and OOP
  5. JavaScript Language Design: Dot Notation be Namespace or Object System
  6. Ontology of Postfix Notation, Method Chaining, and Unix Pipe
  7. Piping and Function Composition Equivalence

If you have a question, put $5 at patreon and message me.