Hacker News new | ask | show | jobs
by darkkindness 2353 days ago
The conversation Bill's touching on -- the tradeoffs between different notations -- is really valuable but I think it misses something a lot of us desire in a syntax: compositionality. Take the provided "onion" notation, loops, and the "new" syntax. They all look something like this:

  ┌────────┬────────────────────┐
  │myreduce│┌─────┬────────────┐│
  │        ││mymap│┌────────┬─┐││
  │        ││     ││myfilter│x│││
  │        ││     │└────────┴─┘││
  │        │└─────┴────────────┘│
  └────────┴────────────────────┘
(The math one looks more like this:)

  ┌────────┬────────────┐
  │myreduce│┌────────┬─┐│
  │        ││mymap   │x││
  │        ││        │ ││
  │        ││myfilter│ ││
  │        │└────────┴─┘│
  └────────┴────────────┘
But none of them provide the same kind of "putting pieces together" feeling as this:

  ┌────────┬─────┬────────┬─┐
  │myreduce│mymap│myfilter│x│
  └────────┴─────┴────────┴─┘
which we see in the wild as this:

  (myreduce ∘ mymap ∘ myfilter)(x)
or this:

  x | myfilter | mymap | myreduce
or this:

  myreduce mymap myfilter x