diff options
Diffstat (limited to '')
-rw-r--r-- | README.md | 131 | ||||
-rw-r--r-- | lux-lein/README.md | 28 | ||||
-rw-r--r-- | stdlib/README.md | 11 |
3 files changed, 89 insertions, 81 deletions
@@ -1,33 +1,41 @@ -[![Join the chat at https://gitter.im/LuxLang/lux](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/LuxLang/lux?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - ## 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.4.0 +0.5.0 ### How far ahead is the project? -Lux is finally in the **beta** stage. The JVM compiler is pretty stable and the standard library has grown to a respectable size. +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 manager your dependencies. -You can find it here: https://github.com/LuxLang/lux-lein +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 a sample Lux project, please take a look at this repository: https://github.com/LuxLang/luxdoc +To take a look at sample Lux projects, check these repositories: -The program in there was actually used to generate most of the documentation for the standard library in the wiki (located over here: https://github.com/LuxLang/lux/wiki/Standard-Library) +* https://github.com/LuxLang/tutorial1 +* https://github.com/LuxLang/luxdoc + +The `luxdoc` program was actually used to generate the documentation for the standard library in the wiki (located here: https://github.com/LuxLang/lux/wiki/Standard-Library) ### What's the license? @@ -48,134 +56,131 @@ 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. -However, most of the types in the prelude are generated via several macros that provide a more pleasant syntax to types. -If you wonder what types look like without makeup, feel free to read the first few hundred lines of lux.lux. +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 & structures are supported. +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 & structures from the rest of the language, whereas Lux implements them on-top of the base language. +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 it's argument. -This means that 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. +Haskell's type-class system forces the user to only specify 1 instance for any given type-class and its argument. -By using a system like ML's, that problem is averted. -Also, by hosting the module system on top of records, which are regular values, you get the further benefit that structures can be parameterized at runtime just like any other data-structures. -You can also write functions that take and return structures (as Functors do in ML) and you can generate structures on the fly. +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. -### Functional programming +By using a system like ML's, that problem is averted. -While the means to do Java-interop will be provided (and there are already a few ways to do it that you can look-up inside lux.lux), Lux is commited to functional programming. +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. -Functions are curried and partial application is as simple as just applying a function to less arguments than it needs (as in Haskell). +You can also write functions that take and return structures (as _functors_ do in ML), and you can generate structures on the fly. -e.g. +> 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. - (map (+ 1) (list 1 2 3 4 5)) +> You can learn more about that by reading the book and the documentation. -### Code portability +### Functional programming -Many languages nowadays support compilation to multiple platforms (e.g. Haskell, Scala, Clojure). -However, sharing code between platforms can be a pain in the neck due to the following reasons: +While the means to do Java-interop are provided, Lux is commited to functional programming. -* differences in features between platforms -* the languages weren't originally designed with the goal of running both native/JVM and in JavaScript +Functions are curried and partial application is as simple as just applying a function to less arguments than it needs (as in Haskell). -Lux is being designed from the ground-up to target multiple platforms and achieve maximum reusability of code with minimum hassle. +e.g. -The mechanism hasn't been added yet to the language (mainly because there's only 1 compiler at the moment), but it will come pretty soon in one of the upcoming releases. + (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 responsibly for the magic by threading **Compiler** instances through macros. -Macros must have the **Macro** type and then be declared as macros. -However, just using the **defmacro** macro will take care of it for you. -Alternatively, you can use the **defsyntax** macro, which also offers monadic parsing of AST tokens for convenience. +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 AST tokens for convenience. ### Custom pattern-matching ##### Wait... wut? -Custom pattern-matching basically means that you can use macros to provide custom syntax & features on top of the pattern-matching macro (case). +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 them inside pattern-matching: +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 ($_ * x y z)) + (#Some ($_ i.* x y z)) _ #None) (case (: (List Int) (list 1 2 3)) - (\ (list x y z)) - (#Some ($_ * x y z)) + (^ (list x y z)) + (#Some ($_ i.* x y z)) _ #None) -There is also the special **\or** macro, which introduces *or patterns*: +There is also the special **^or** macro, which introduces *or patterns*: (type: Weekday - (| #Monday - #Tuesday - #Wednesday - #Thursday - #Friday - #Saturday - #Sunday)) + #Monday + #Tuesday + #Wednesday + #Thursday + #Friday + #Saturday + #Sunday)) (def: (weekend? day) (-> Weekday Bool) (case day - (\or #Saturday #Sunday) - true - - _ - false)) + (^or #Saturday #Sunday) + true -##### Please note: \ and \or are just macros like any other and anyone can implement them. + _ + false)) -I'll be adding more useful pattern-matching macros in upcoming releases of the language. - -If you want to see how they work, just check out their implementation inside lux.lux +> Please note: ^ and ^or are just macros like any other and anyone can implement them. ### Is there a community for this? -Come join the budding community by joining the discussion group at: https://groups.google.com/forum/#!forum/lux-programming-language +Come join the discussion group at: https://groups.google.com/forum/#!forum/lux-programming-language If you want to communicate with me directly, just email me at luxlisp@gmail.com +Also, you can chat with us on Gitter: +[![Join the chat at https://gitter.im/LuxLang/lux](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/LuxLang/lux?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + ### How can I edit Lux code? -Check out the Emacs plugin for it: https://github.com/LuxLang/lux-mode +Check out the Emacs plugin for it: https://github.com/LuxLang/lux/tree/master/lux-mode ### Where do I learn Lux? -Head to the wiki and check out the documentation for the currently available modules. +The main resource is the book: https://www.gitbook.com/book/luxlang/the-lux-programming-language/details -You should also check out the Lux DevLog, where I talk about different topics related to Lux and post tutorials: http://luxlang.blogspot.com/ +It will always be up-to-date with the latest stable version of the language. + +Also, you can head to the wiki and check out the documentation for the currently available modules: https://github.com/LuxLang/lux/wiki/Standard-Library + +Finally, you can check out the Lux DevLog, where I talk about different topics related to Lux and post tutorials: http://luxlang.blogspot.com/ ### 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). +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. Communication is done over Gitter and the Google group. -##### Copyright (c) 2015-2016 Eduardo Julian. All rights reserved. - +##### Copyright (c) 2014-2017 Eduardo Julian. All rights reserved. diff --git a/lux-lein/README.md b/lux-lein/README.md index 6d024a58f..018195dcb 100644 --- a/lux-lein/README.md +++ b/lux-lein/README.md @@ -5,23 +5,27 @@ You'll need a project.clj that imports the lein-luxc plugin. Here's an example: ``` -(defproject com.github.luxlang/lux-stdlib "0.4.0" - :description "Standard library for the Lux programming language." - :url "https://github.com/LuxLang/stdlib" - :license {:name "Mozilla Public License (Version 2.0)" - :url "https://www.mozilla.org/en-US/MPL/2.0/"} - :plugins [[com.github.luxlang/lein-luxc "0.3.0"]] +(defproject lux/tutorial1 "0.1.0-SNAPSHOT" + :plugins [[com.github.luxlang/lein-luxc "0.5.0"]] + :dependencies [[io.vertx/vertx-web "3.0.0"]] :source-paths ["source"] + :test-paths ["test"] + :lux {:program "tutorial1 + tests "tests"} ) - ``` Now, all you need to do is run the plugin like this: - lein luxc compile - -And, if you want to run unit-tests, you can do: + lein lux build + +There is also the _auto-build_ feature, which will re-build your project every time a file changes. + + lein lux auto build + +And, if you want to run your tests, you can do: - lein luxc test + lein lux test + lein lux auto test -Those unit tests must be in the `test` directory on your project root. +Those tests must be in the `test` directory on your project root. diff --git a/stdlib/README.md b/stdlib/README.md index 454228d07..3d6e30bc6 100644 --- a/stdlib/README.md +++ b/stdlib/README.md @@ -1,14 +1,13 @@ # stdlib -Standard library for the Lux family of programming languages. +Standard library for the Lux programming language. ### How do I get it? -Just add this to your Leiningen dependencies when building Lux programs: -``` -[com.github.luxlang/lux-stdlib "0.3.3"] -``` +You will get it automatically by just using the Leiningen plugin for Lux. -You can find the Leiningen plugin for Lux over here: https://github.com/LuxLang/lux-lein +The plugin will fetch for you both the compiler and the standard library, all matched with the plugin's version. + +You can find the Leiningen plugin for Lux over here: https://github.com/LuxLang/lux/tree/master/lux-lein ### How do I use it? |