danprince / zaphod

🌌 Clojure's API for JavaScript's Objects
https://zaphod.surge.sh
MIT License
54 stars 1 forks source link

implement `diff` #27

Open bhurlow opened 6 years ago

bhurlow commented 6 years ago

loving using zaphod in js

would be interested in some set methods, union, diff, contains?

danprince commented 6 years ago

I don't see why not. Doesn't seem like the function bind operator is going to make it into the language at this point, so I'm thinking of doing a large rewrite of this project to use the pipeline operator instead.

When I get around to that, I'll think about adding some methods from Clojure's set api too.

bhurlow commented 6 years ago

@danprince yea that's what I'm hearing, kind of a bummer because the function bind op become pretty useful to me. What's your sense on buy in on the pipeline operator? It seems similarly abandoned to me. Nonetheless, I find myself reaching for a lot of the clojure stdlib stuff and I'd love to see that API in an easy shape in js

danprince commented 6 years ago

Yeah. I hear you. Pipe operator hit Stage 1, whereas bind never made it out of Stage 0.

Seems like the closest compatible, chainable syntax.

set |> union(whitelist) |> diff(blacklist)
// vs
set::union(whitelist)::diff(blacklist)

Still prefer the bind syntax, but the pipe has analogies in F#, Elm, Reason, Elixir etc. My hunch is that will give it more chance of making it into the spec.