zaphod icon indicating copy to clipboard operation
zaphod copied to clipboard

implement `diff`

Open bhurlow opened this issue 7 years ago • 3 comments

loving using zaphod in js

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

bhurlow avatar Aug 14 '18 15:08 bhurlow

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.

danprince avatar Aug 14 '18 18:08 danprince

@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

bhurlow avatar Aug 14 '18 18:08 bhurlow

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.

danprince avatar Aug 14 '18 19:08 danprince