

Ki – A lisp for your JavaScript - threepointone
http://ki-lang.org/

======
roryokane
See also LispyScript ([http://lispyscript.com/](http://lispyscript.com/)), “a
JavaScript with Lispy syntax and macros”.

Like Ki, it requires inclusion of a standard library. Unlike Ki, it does not
provide alternative data structures in addition to native JS values; it only
uses native JS values. LispyScript also does not support embedded JavaScript
or being embedded within JavaScript. But LispyScript currently has better
docs, including a page to try it in the browser
([http://lispyscript.com/tryit/](http://lispyscript.com/tryit/)).

~~~
lantiga
I agree, LispyScript is very neat, closer to a full-fledged language than ki.
On the other hand, ki is focused on ClojureScript's immutable data structures
and related idioms - in fact it's just a thin layer around those.

~~~
zachrose
Can anyone enlighten me to the difference between Clojure-like immutability
and Object.freeze()?

~~~
lantiga
The main difference is structural sharing: I can update a Clojure map with a
new value, which will create another map that shares the vast majority of the
data with the former map. With plain JavaScript, you'd have to clone your
object, update it and freeze it again. In addition Clojure/ClojureScript/mori
offer a whole API designed to leverage immutable data structures.

------
VMG
See also: [https://github.com/Gozala/wisp](https://github.com/Gozala/wisp)

~~~
agumonkey
For a second I thought wisp was
[http://will.thimbleby.net/misc/](http://will.thimbleby.net/misc/) but nope.

------
oweiler
Why would I want to use this in preference to ClojureScript?

~~~
weavie
I'm guessing, since this is a set of sweet.js macros you could mix Ki and
Javascript code in the same file. So you could only use the lisp bits when you
really needed to.

~~~
lantiga
[Hi, author here] Yes, that is basically the idea. ki functions are js
functions, same goes for vars, which makes it easy to jump from js to ki and
back, without giving up on immutability, etc. Note that ki is not really
intended as a ClojureScript alternative at all. It's more a way to take
advantage of its data structures and some of its expressiveness from a pure JS
ecosystem.

------
j_s
I'd appreciate any opinions on how usable something like this or ClojureScript
is to transition to in an enterprise / team environment. How can I sell that
switch to my employer and co-workers?

~~~
klibertp
You can't. Forget it.

I mean, there is a whole long list of benefits of functional programming,
immutable/persistent data structures, macros and so on. But Lisps and
functional oriented languages (like Roy, LiveScript) are also unfamiliar, not
supported in your favourite IDE, make you think in a way you're not accustomed
to and eat your kittens for lunch.

You have a chance with ClojureScript if the backend is in Clojure - other than
this there is just no way to introduce something like this.

As for usability, ClojureScript works very, very well. Async is well
implemented (if you like CPS model), JS scoping is fixed and so on. LiveScript
is also quite usable, although it lacks source map implementation for now.
Backcalls make async nice but stay close to JS, currying and partials are
nice, easy object cloning makes up for inherent mutability. For my personal
projects I use LS instead of JS or Coffee exclusively now.

But they are completely unusable in enterprise environment. And probably won't
ever be. It would also be very hard to find a team which would like to adopt
them without knowing them beforehand (rightly so, IMHO, because transitioning
to another paradigm - and benefiting from it - is not a trivial matter) and
about as hard (or harder) to find a team where they are known already.

Your best bet is probably to contribute to LightTable a lot and seek a job in
Clojure oriented start-up if you want to use ClojureScript at work.

------
leishulang
The only reason I use clojurescript over other js lisps is core.async. What is
Ki's take on this?

~~~
lantiga
I have ideas around providing CSP in ki, but so far I haven't implemented
them. All there is in ki right now is the (letc ...) form (see [http://ki-
lang.org/api.html#misc](http://ki-lang.org/api.html#misc)), which provides
very similar functionality to LiveScript's backcalls. It is no CSP but it
allows to straighten up nested async calls.

------
hajile
There is already a ki lisp (a smaller subset of Qi lisp) that is the
foundation of shen lisp.

[http://www.shenlanguage.org/learn-
shen/shendoc.htm#KI](http://www.shenlanguage.org/learn-shen/shendoc.htm#KI)

~~~
lantiga
It's actually named KL (with a lower-case L), but yes, that was close.

~~~
eggy
What's the difference? I mean, Shen is ported to JS, and doesn't require Node.
Can it play with JS like KL? Shen is pretty cool with a built-in, functional
Prolog too, and static typing you can turn on or off.

~~~
lantiga
Shen is pretty amazing, it's a full fledged functional language with lots of
features and lots of compilation backends. I don't think there's a lot of
ground for a comparison with ki, which is much more limited in scope.

------
jeletonskelly
As a clojure developer that sometimes crosses the line into the front-end
world, this is going to make my life much easier.

~~~
afandian
Why does this make your life easier than clojurescript?

~~~
sunkencity
not everybody likes the jvm ecosystem.

~~~
afandian
If the person I replied do doesn't like the JVM why are they writing Clojure
in the first place?

~~~
sunkencity
I've programmed lots of clojure. But in the end, I am too annoyed by the jvm
ecosystem, the good that is clojure doesn't weight up the java crap, so while
I love the language, I cannot stand the environment.

~~~
afandian
I'm interested to hear about your experience. What do you find annoying about
the JVM? That notwithstanding, I wasn't asking about yours, I was replying to
jeletonskelly's, which seems to be different to yours.

------
lsdafjklsd
Trying to find ways to integrate react / om / clojurescript into my Ember app
and this is perfect. Thank you!

------
timwaagh
like this. im not sure how much an improvement this is over for example
underscore (i guess i'll find out), but at least i can finally -kinda- say i
write bloody LISP when i put this in my code :P

------
fdsary
Woow! This is really fucking cool! Thanks for sharing.

~~~
lantiga
Glad you find it interesting, looking forward to future feedback.

