6 ms·
Ki – A lisp for your JavaScript
- fdsary 12y agoWoow! This is really fucking cool! Thanks for sharing.
- lantiga 12y agoGlad you find it interesting, looking forward to future feedback.
- oweiler 12y agoWhy would I want to use this in preference to ClojureScript?
- sunkencity 12y agobecause the jvm is a pain?
- jhh 12y agoClojureScript is not executed on the JVM.
- adambard 12y agoBut it does have a fairly tight integration with clojure, and also uses the JVM-based closure compiler. However, I'd way rather see a clojurescript runtime for v8 than another language "inspired by" clojurescript.
- vmind 12y agoDo you mean a ClojureScript compiler compiled to JavaScript? ClojureScript can be compiled and run in v8 just fine right now.
- integraton 12y agoHow do you compile clojurescript without the JVM?
- leishulang 12y agohttps://github.com/Bronsa/CinC https://github.com/Bronsa/CinC when this is done. Some people are working hard on it.
- SkyMarshal 12y agoI think he means ClojureScript completely divorced from the JVM, so you don't need a Java infrastructure to develop/compile ClojureScript.
- chc 12y agoV8 already is a ClojureScript runtime, isn't it?
- weavie 12y agoI'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 12y ago[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.
- VMG 12y agoSee also: https://github.com/Gozala/wisp https://github.com/Gozala/wisp
- agumonkey 12y agoFor a second I thought wisp was http://will.thimbleby.net/misc/ http://will.thimbleby.net/misc/ but nope.
- leishulang 12y agowisp is a fork of lispyscript but more clojure oriented .
- jeletonskelly 12y agoAs a clojure developer that sometimes crosses the line into the front-end world, this is going to make my life much easier.
- afandian 12y agoWhy does this make your life easier than clojurescript?
- sunkencity 12y agonot everybody likes the jvm ecosystem.
- flixic 12y agoClojurescript compiles to Javascript, it does not run on JVM; Clojure does.
- douchescript 12y agoSo the compiler and toolchain in javascript then? News to me.
- afandian 12y agoIf the person I replied do doesn't like the JVM why are they writing Clojure in the first place?
- sunkencity 12y agoI'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 12y agoI'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 12y agoTrying to find ways to integrate react / om / clojurescript into my Ember app and this is perfect. Thank you!
- roryokane 12y agoSee 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 12y agoI 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 12y agoCan anyone enlighten me to the difference between Clojure-like immutability and Object.freeze()?
- lantiga 12y agoThe 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.
- evacchi 12y agoalso JavathScript http://kybernetikos.github.io/Javathcript/ http://kybernetikos.github.io/Javathcript/
- leishulang 12y agoThe only reason I use clojurescript over other js lisps is core.async. What is Ki's take on this?
- lantiga 12y agoI 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.
- j_s 12y agoI'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 12y agoYou 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.
- timwaagh 12y agolike 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
- hajile 12y agoThere 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 12y agoIt's actually named KL (with a lower-case L), but yes, that was close.
- eggy 12y agoWhat'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 12y agoShen 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.
- deleted 12y ago[deleted]