All Projects → LuxLang → Lux

LuxLang / Lux

Licence: other
The Lux Programming Language

Programming Languages

clojure
4091 projects
haskell
3896 projects
language
365 projects
lisp
113 projects
macros
77 projects
types
53 projects

Projects that are alternatives of or similar to Lux

Scallina
A Coq-based synthesis of Scala programs which are correct-by-construction
Stars: ✭ 65 (-94.63%)
Mutual labels:  functional-programming
Ecto morph
morph your Ecto capabilities into the s t r a t o s p h e r e !
Stars: ✭ 72 (-94.05%)
Mutual labels:  functional-programming
Pfun
Functional, composable, asynchronous, type-safe Python.
Stars: ✭ 75 (-93.81%)
Mutual labels:  functional-programming
Lambdatest
Functional testing for Scala.
Stars: ✭ 65 (-94.63%)
Mutual labels:  functional-programming
Fo
An experimental language which adds functional programming features to Go.
Stars: ✭ 1,158 (-4.38%)
Mutual labels:  functional-programming
Ramtuary
Ramda + Ramda Fantasy + Sanctuary REPL 🌿
Stars: ✭ 72 (-94.05%)
Mutual labels:  functional-programming
Mgo
Purely functional genetic algorithms for multi-objective optimisation
Stars: ✭ 63 (-94.8%)
Mutual labels:  functional-programming
Desafios
FP Challenges
Stars: ✭ 77 (-93.64%)
Mutual labels:  functional-programming
Parsing With Haskell Parser Combinators
🔍 A step-by-step guide to parsing using Haskell parser combinators.
Stars: ✭ 72 (-94.05%)
Mutual labels:  functional-programming
Lila
♞ lichess.org: the forever free, adless and open source chess server ♞
Stars: ✭ 10,315 (+751.78%)
Mutual labels:  functional-programming
Codeworld
Educational computer programming environment using Haskell
Stars: ✭ 1,142 (-5.7%)
Mutual labels:  functional-programming
Json Decoder
Type safe JSON decoder for TypeScript
Stars: ✭ 67 (-94.47%)
Mutual labels:  functional-programming
Not Awesome Es6 Classes
A curated list of resources on why ES6 (aka ES2015) classes are NOT awesome
Stars: ✭ 1,185 (-2.15%)
Mutual labels:  functional-programming
Lambda
Fun with λ calculus!
Stars: ✭ 65 (-94.63%)
Mutual labels:  functional-programming
Scalaz Plugin
A compiler plugin that will improve on the scala compiler on the assumption that the user is using the Scalazzi-safe subset of Scala.
Stars: ✭ 76 (-93.72%)
Mutual labels:  functional-programming
Iflux
iflux = immer.js + react.js
Stars: ✭ 64 (-94.72%)
Mutual labels:  functional-programming
Cyclops
An advanced, but easy to use, platform for writing functional applications in Java 8.
Stars: ✭ 1,180 (-2.56%)
Mutual labels:  functional-programming
Command Center
A CLI-based launcher and general productivity tool.
Stars: ✭ 78 (-93.56%)
Mutual labels:  functional-programming
Incompose
A inferno utility belt for function components and higher-order components
Stars: ✭ 76 (-93.72%)
Mutual labels:  functional-programming
Request via
RequestVia: A Functional HTTP Client That Wraps Net::HTTP
Stars: ✭ 74 (-93.89%)
Mutual labels:  functional-programming

What is Lux?

Lux is a new programming language in the making.

It's meant to be a functional, statically-typed Lisp that will run on several platforms, such as the Java Virtual Machine and JavaScript interpreters.

What's the current version?

0.5.0

How far ahead is the project?

Lux is in the beta stage.

The JVM compiler is pretty stable and the standard library has grown to a respectable size.

Also, new experimental support for Android has been added.

How can I use it?

You should use the Leiningen plugin for Lux to compile your programs and manage your dependencies.

You can find it here: https://github.com/LuxLang/lux/tree/master/lux-lein

After compiling your program, this will generate a directory named "target" and put all the .class files there.

Then, you can run the program like this:

java -jar target/jvm/program.jar

Sample

To take a look at sample Lux projects, check these repositories:

The luxdoc program was actually used to generate the documentation for the standard library (located here: https://luxlang.github.io/lux/)

What's the license?

Custom License

Read carefully before using this project, as the license disallows commercial use, and has other conditions which may be undesirable for some.

What's interesting about the language?

Inspirations

The language is mostly inspired by the following 3 languages:

  • Haskell (functional programming)
  • Clojure (syntax, overall look & feel)
  • ML (module system)

The compiler is even implemented in Clojure.

Types

They are implemented as plain-old data-structures whose expressions get eval'ed by the compiler and integrated into the type-checker.

That means it's actually possible to generate types via functions and macros.

Module system

The module system is heavily inspired by ML, and both signatures and structures are supported.

The main difference between Lux and ML is that ML separates signatures and structures from the rest of the language, whereas Lux implements them on top of the base language.

How?

By implementing signatures as record-types and structures as actual records.

But, why not just use type-classes?

Haskell's type-class system forces the user to only specify 1 instance for any given type-class and its argument.

If there are more than 1 possible valid instances (as is the case for Monoid of Int), you have to resort to newtype hacks to be able to provide alternative implementations.

By using a system like ML's, that problem is averted.

Additionally, by hosting the module system on top of records, which are regular values, you get the further benefit that structures can be parameterized at run-time just like any other value.

You can also write functions that take and return structures (as functors do in ML), and you can generate structures on the fly.

Also, Lux now offers a mechanism for easy polymorphism, just like Haskell's type-classes, but built upon it's module system, thanks to the lux/type/auto module and its ::: macro.

You can learn more about that by reading the book and the documentation.

Functional programming

While the means to do Java-interop are provided, Lux is commited to functional programming.

Functions are curried and partial application is as simple as just applying a function to less arguments than it needs (as in Haskell).

e.g.

(map (i.+ 1) (list 1 2 3 4 5))

Macros

Unlike in most other lisps, Lux macros are monadic.

The (Lux a) type is the one responsible for the magic by threading Compiler instances through macros.

You can use macro: to define these monadic macros.

Alternatively, you can use the syntax: macro, which also offers monadic parsing of Code tokens for convenience.

Custom pattern-matching

Wait... wut?

Custom pattern-matching basically means that you can use macros to provide custom syntax and features on top of the pattern-matching macro case.

For instance, the list and list& macros are used to build lists. But you can also use them to destructure lists inside pattern-matching:

(case (: (List Int) (list 1 2 3))
  (#Cons x (#Cons y (#Cons z #Nil)))
  (#Some ($_ i.* x y z))

  _
  #None)

(case (: (List Int) (list 1 2 3))
  (^ (list x y z))
  (#Some ($_ i.* x y z))

  _
  #None)

There is also the special ^or macro, which introduces or patterns:

(type: Weekday
  #Monday
  #Tuesday
  #Wednesday
  #Thursday
  #Friday
  #Saturday
  #Sunday))

(def: (weekend? day)
  (-> Weekday Bool)
  (case day
    (^or #Saturday #Sunday)
    true

    _
    false))

Please note: ^ and ^or are just macros like any other and anyone can implement them.

Is there a community for this?

Come join the forum at: http://luxlang.freeforums.net/

If you want to communicate with me directly, just email me at [email protected]

How can I edit Lux code?

Check out the Emacs plugin for it: https://github.com/LuxLang/lux/tree/master/lux-mode

Where do I learn Lux?

The main resource is the book: https://www.gitbook.com/book/luxlang/the-lux-programming-language/details

It will always be up-to-date with the latest stable version of the language.

Also, you can check out the documentation for the currently available modules: https://luxlang.github.io/lux/

How can I contribute?

For starters, you can check out the Trello board for Lux development: https://trello.com/b/VRQhvXjs/lux-jvm-compiler

I'll be putting there tasks that people can contribute to; both in the compiler and outside (like plugins for editors).

Writing libraries in Lux will also help a lot in making this a more practical language for day to day use.

Copyright (c) 2014-2021 Eduardo Julian. All rights reserved.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].