I am aware of Dylan, however it did not have any influence on Nulan.
Nulan's macro system is very similar to Common Lisp or Arc's macro system, in the sense that a macro is simply a compile-time function that accepts code and returns code.
That means you can use all of the standard stuff within a macro: loops, filters, maps, etc.
Nulan achieves hygiene with two different techniques:
1) Gensyms. This is a standard technique in Common Lisp and Arc. But it only works for locally-defined variables.
2) All global variables are replaced with gensyms, and when a macro expands to a global variable, Nulan will automatically replace it with the appropriate gensym.
There were some bugs in the tutorial, which I fixed just now. If the tutorial wasn't working for you, please try again.
----
This is a pleasant surprise: I honestly was not expecting this, since Nulan is not yet ready to show off.
As explained on the GitHub page, Nulan is currently in development, and does not work.
The tutorial is for a very old version of Nulan from January 2013.
From 2013 to 2016, Nulan has changed dramatically. The latest design of Nulan barely resembles the tutorial.
Probably the biggest change is that Nulan is now statically typed rather than dynamically typed. Its type system is very similar to Haskell, SML, OCaml, etc.
Nulan is a purely functional language, like Haskell. Impure I/O is done using the Task monad.
Nulan also has a feature which is very similar to Haskell's typeclasses, giving a great amount of extensibility, flexibility, and abstraction.
----
The current goal of Nulan is to merge the benefits of Haskell and Lisp, while compiling to very efficient JavaScript code which can run in either the browser or Node.js
I put a heavy emphasis on readability, correctness, performance, and refactoring. I want Nulan to be the kind of language which makes refactoring programs very easy.
----
If you want a taste of the latest version of Nulan, I recommend taking a look at this file:
As proof of how rapidly Nulan is changing, some parts of the standard library are using older Nulan syntax. They will eventually be updated to the latest syntax.
----
Nulan also has an FFI system, which makes it possible to use JavaScript libraries in Nulan, bypass the static type system, add new features, or gain additional performance.
A significant amount of Nulan's standard library is written using the FFI, which you can find here:
7 comments
[ 2.9 ms ] story [ 22.6 ms ] threadI'd love to see some examples of pattern matching in the tutorial as well!
I see that you're in the steps of developing a 0.2... what are the expected changes going to be?
About the features of the new version, maybe, you can ask him with a github issue...
Edit: Here is the issue
https://github.com/Pauan/nulan/issues/1
Nulan's macro system is very similar to Common Lisp or Arc's macro system, in the sense that a macro is simply a compile-time function that accepts code and returns code.
That means you can use all of the standard stuff within a macro: loops, filters, maps, etc.
Nulan achieves hygiene with two different techniques:
1) Gensyms. This is a standard technique in Common Lisp and Arc. But it only works for locally-defined variables.
2) All global variables are replaced with gensyms, and when a macro expands to a global variable, Nulan will automatically replace it with the appropriate gensym.
This is similar to Common Lisp's package system.
----
Here is an example of a Nulan macro:
This says that:(AND 1 2) should be replaced with (IF 1 2 false)
(AND 1 2 3) should be replaced with (IF 1 (IF 2 3 false) false)
(AND 1 2 3 4) should be replaced with (IF 1 (IF 2 (IF 3 4 false) false) false)
----
The & syntax is similar to ` in other Lisps except that it replaces global variables with gensyms.
The ~ syntax is similar to , in other Lisps.
The ~@ syntax is similar to ,@ in other Lisps.
----
Here is an alternate way of writing the AND macro:
The reduce-right function is the same as foldr in Haskell, or fold-right in Scheme.This demonstrates that we can run arbitrary code at compile-time.
----
Although Nulan macros are hygienic by default, you can intentionally break hygiene when you need to, by inserting symbols:
The above macro is the same as Arc's aif macro. You use it like this: Essentially, it is identical to IF, except that it binds "foo" to the local variable "it", which can then be used inside the body of the AIF.In general, Nulan macros are just as convenient and powerful as Common Lisp or Arc macros.
----
For a list of some of the changes, please see this post:
https://news.ycombinator.com/item?id=11104671
There were some bugs in the tutorial, which I fixed just now. If the tutorial wasn't working for you, please try again.
----
This is a pleasant surprise: I honestly was not expecting this, since Nulan is not yet ready to show off.
As explained on the GitHub page, Nulan is currently in development, and does not work.
The tutorial is for a very old version of Nulan from January 2013.
From 2013 to 2016, Nulan has changed dramatically. The latest design of Nulan barely resembles the tutorial.
Probably the biggest change is that Nulan is now statically typed rather than dynamically typed. Its type system is very similar to Haskell, SML, OCaml, etc.
Nulan is a purely functional language, like Haskell. Impure I/O is done using the Task monad.
Nulan also has a feature which is very similar to Haskell's typeclasses, giving a great amount of extensibility, flexibility, and abstraction.
----
The current goal of Nulan is to merge the benefits of Haskell and Lisp, while compiling to very efficient JavaScript code which can run in either the browser or Node.js
I put a heavy emphasis on readability, correctness, performance, and refactoring. I want Nulan to be the kind of language which makes refactoring programs very easy.
----
If you want a taste of the latest version of Nulan, I recommend taking a look at this file:
https://github.com/Pauan/nulan/blob/f008287f9ddeeffa0f20aa0d...
It lists all of the major features which are currently in Nulan's design. Things are still in major flux, and are constantly changing.
----
Nulan has been designed to make it easy to create high quality libraries, and it includes a robust standard library, which you can find here:
https://github.com/Pauan/nulan/tree/f008287f9ddeeffa0f20aa0d...
As proof of how rapidly Nulan is changing, some parts of the standard library are using older Nulan syntax. They will eventually be updated to the latest syntax.
----
Nulan also has an FFI system, which makes it possible to use JavaScript libraries in Nulan, bypass the static type system, add new features, or gain additional performance.
A significant amount of Nulan's standard library is written using the FFI, which you can find here:
https://github.com/Pauan/nulan/tree/f008287f9ddeeffa0f20aa0d...