Ki - Lisp for JavaScript
Written by Kay Ewbank   
Sunday, 22 June 2014

A new functional language has been released for JavaScript. Ki enables the use of functional idioms and data structures directly in JavaScript.

 

kibanner

According to the language’s website, ki’s syntax and semantics are heavily inspired by Clojure. It is a functional programming language that expands into JavaScript through a very thin layer of sweet.js macros. Using ki means you can make use of functional programming idioms and immutable data structures. ki can be used to write entire applications, individual components (e.g. state management) or just functional one-liners.

One advantage of Lisp and similar languages is their extensibility. The actual language of Lisp has a minimal syntax, but you can then extend it. Common Lisp even has the motto of “the programmable programming language." If you’re programming Lisp, and you come across a feature that would make your program easier to write but that is missing from Lisp, you can just add it for yourself.

Ki as it comes has support for lambdas, lexical scoping, namespaces, local bindings, recursion, persistent data structures, lazyness, data literals, keywords, multiple arity functions, backcall-style continuations, multimethods, atoms and macros, and source maps. Ki also has threading macros that make it easy to concatenate computations.

Ki has been created by Luca Antiga of Orobix, specialists in image analysis and data engineering, and the company has used ki to handle mutable state for some apps. Antiga says ki could be used to create domain-specific languages through macros. A ki port of the React.js tutorial is included on the ki website as an example of this in action.

Antiga told I Programmer:

The macros in ki are designed to play particularly well with mori, a library providing "ClojureScript's persistent data structures and supporting API from the comfort of vanilla JavaScript", which are the real asset for writing pure, functional code.

Joking that ki is the Flappy Bird of programming languages, Antiga added that Ki is very tiny and that all the heavy lifting is done by sweet.js and mori.

Ki is offered under the liberal MIT license and can be downloaded from the ki language website (http://ki-lang.org/).

 

Banner


Ibis 8 Adds Streaming
05/03/2024

Ibis 8.0 has been released with stream processing backends. The new release includes Apache Flink as a streaming backend, and RisingWave, a streaming database backend. There's also a new batch backend [ ... ]



Angular and Wiz To Merge
27/03/2024

Two web development frameworks used at Google are merging. One, Angular is open source and widely known, while the other, Wiz, is an internal web framework developed and used by Google for some o [ ... ]


More News

 

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 23 June 2014 )