prakhar1989 / JSJS

A strongly typed language for the web!
http://jsjs-lang.org
MIT License
40 stars 5 forks source link

Pipeline operator #39

Open prakhar1989 opened 8 years ago

prakhar1989 commented 8 years ago

Add a pipeline operator to simplify function composition.

OCaml syntax

# let path = "/usr/bin:/usr/local/bin:/bin:/sbin";;
val path : string = "/usr/bin:/usr/local/bin:/bin:/sbin"
#   String.split ~on:':' path
  |> List.dedup ~compare:String.compare
  |> List.iter ~f:print_endline
  ;;
prakhar1989 commented 8 years ago

Inspiration - https://docs.hhvm.com/hack/operators/pipe-operator. Good ideas on using $$ as placeholder for capturing output.