days
1
0
hours
0
0
minutes
1
3
seconds
2
4
At the intersection between Haskell, Clojure and ML

Lux — A functional programming language in the Lisp tradition

Gabriela Motroc

There’s a new language in town; Lux (currently in development) is a functional language belonging to the Lisp family which can be used to write a variety of programs that can run on the JVM.

Although the Lux language is currently in development (current version is 0.5.0), it can be used to write a variety of programs that can run on the Java Virtual Machine. However, its semantics are not tied to those of the JVM, so this language should be understood as a “universal language; meant to express programs in a way that is as cross-platform as possible, while at the same time able to tap into the richness that each particular platform has got to offer.”

What’s under Lux’s hood?

Lux is a purely-functional programming language but it also adopts “eager-evaluation over lazy-evaluation, to promote simpler reasoning over the performance and behavior of programs.” The language has been inspired by Haskell (functional programming), Clojure (syntax, overall look & feel) and ML (module system) and the compiler is implemented in Clojure. However, unlike Clojure, Lux is statically typed to boost performance and diminish bugs.

Types are implemented as plain-old data-structures whose expressions get evaluateded by the compiler and integrated into the type-checker, which means types can be generated via macros and functions. Furthermore, ML is the inspiration for the module system, but one thing that sets them apart is that while it separates signatures and structures from the rest of the language, Lux implements them on top of the base language (signatures are implemented as record-types and structures as actual records).

Functional programming to the bone

Although the language offers the means to do Java-interop, Lux is committed to functional programming. It also allows the developers to do “meta-programming”; first-class types can be examined and constructed at compile-time, monadic macros have access to the state of the compiler, and the style of macro definition promotes composition and easy interaction between different macros. Plus, new experimental support for Android has been added.

Lux is both a simple and a complex language. It’s design allows you to make effective programs with just a small subset of what it has to offer, but the goal of the language is to provide its users with an arsenal of powerful tools to suit their various needs in their projects.

According to the book, even though functional languages are normally the darlings of academics, Lux is meant for day-to-day usage by software engineers.

asap

Author
Gabriela Motroc
Gabriela Motroc is editor of JAXenter.com and JAX Magazine. Before working at S&S Media she studied International Communication Management at The Hague University of Applied Sciences.

Comments
comments powered by Disqus