HN user

jonase

198 karma
Posts10
Comments13
View on HN

Thanks! So if I read your comment correctly there is nothing inherently wrong with the Comparable interface it's just that Clojure's sorted sets and maps could have used protocols instead. I can see why that would be useful for extending existing types (as you mentioned).

OTOH it’s not often I’ve seen third-party types that I wanted to be comparable but were not. In general I think that if a type does not implement a core interface you have to consider the possibility that the designer chose not to implement it for a reason.

Sorry to jump in on an interesting discussion but I got interested in this part:

It's also disheartening to see that the sorted-set wants things that implement Java's Comparable.

Could you quickly explain what's disheartening about Java's Comparable interface and what the available options are?

At akvo.org we are using Clojure in production and hopefully soon also Clojurescript.

We are using Clojure on top of existing Java functionality, and we're moving our Ember based Dashboard over to Clojurescript/Om.

Why use Clojure? 13 years ago

Am I missing something here or is the algorithm you describe simply: "Find the smallest even and odd number in a set of numbers?" This shouldn't be hard to do in any language.

It means that you can write pure functions (in the functional programming sense) where one (or more) of the arguments to your function is a _database value_. In haskell the types to a query function would perhaps look like this:

    query :: Query -> DBValue -> Result
instead of
    performQuery :: Query -> IO DBConn -> IO Result