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


Quantum Computing Prize Awarded
05/04/2024

John Preskill, Professor of Theoretical Physics at the California Institute of Technology, is the eighth recipient of the John Stewart Bell Prize for Research on Fundamental Issues in Quantu [ ... ]



Udacity's New Discovering Ethical AI Course
12/04/2024

Udacity has just launched an hour-long course on Ethical AI. Intended for a wide audience across many industries, it introduces to basic concepts and terms needed to step into the world of Ethica [ ... ]


More News

 

raspberry pi books

 

Comments




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

Last Updated ( Monday, 23 June 2014 )