lynaghk / singult

JavaScript Hiccup compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unify key-fn does not accept (cljs) keywords

jblomo opened this issue · comments

Image a data set of (cljs) maps with an :id key. One may want to use

(unify @data some-fn
       :key-fn :id)

But the coffee implementation calls the key-fn directly key_fn(d,i). Clojurescript implements keywords-as-functions by adding the #call method: key_fn.call(null, d, i).

https://github.com/lynaghk/singult/blob/master/src/coffee/Singult.coffee#L223

(One can get around this by specifying an anonymous function instead:

(unify @data some-fn
       :key-fn #(:id %))

)