lantiga / ki

lisp + mori, sweet.js

Home Page:ki-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keywords can't be treated as functions

jogrms opened this issue · comments

ki require core
ki (:a {:a :b}) 

Results in

TypeError: keyword(...) is not a function

Example:
http://ki-lang.org/editor/editor.html#ki%20require%20core%0Aki%20(:a%20%7B:a%20:b%7D)

Yes, this is a known limitation, at least for now. Keywords cannot be evaluated in ki as they are in Clojure, you should use get in the meantime:

ki require core
return ki (get {:a :b} :a)

Can we make the keyword function return a function?

The keyword function currently returns a ClojureScript keyword object. We could indeed make keyword return a function and attach all properties of the keyword object to it (making it callable in a way), but this breaks things like equals, etc in mori. Any thoughts?