JavaScript is getting another option for functional programming, called Ki.

Described as a "Lisp for your JavaScript," Ki enables use of functional idioms and data structures -- the persistent data structures of the ClojureScript compiler and related libraries -- directly within JavaScript, said Luca Antiga, author of Ki and principal scientist at image analysis and data engineering vendor Orobix. "You can use Ki to develop an entire application, a module, a function or even parts of it, with minimal friction with respect to the rest of the JavaScript ecosystem."

Lisp languages are recognized as a historical element of computing, but Lisp-like languages are exceptionally extensible, said Antiga. "Once you get past the parentheses, you realize that Lisp has essentially no syntax except the very bare minimum, and that bare minimum is very explicit."

Ki is written as a thin layer of Sweet.js macros, made possible because JavaScript has a lot of functional traits. While Ki does not allow a lot beyond JavaScript's current capabilities, adopting functional idioms becomes more straightforward if a developer can write Lisp. Ki has lexical scoping that can be emulated in JavaScript by manually enclosing scopes in functions, but at the price of sacrificing readability, said Antiga. It also has threading macros that make it easy to concatenate computations.

The field of technologies providing functional capabilities for JavaScript is growing. Ramda brings a functional library to JavaScript, as does Underscore. While praising Ramda and Underscore, Antiga said Ki makes functional JavaScript more expressive, thanks to its Lisp idiom, without the need for committing to a full-fledged language, platform, or ecosystem. Ki is offered under the liberal MIT license.

Developers can use Ki to create domain-specific languages (DSLs) through macros, which make it easy to build a syntax and generate leaner, more manageable code, Antiga said, citing a Ki port of the React.js tutorial as an example. He described Ki as a "young project" at this stage, albeit one that has had thorough tests and a good degree of stability. His own company has used it to handle mutable state for front-end applications.