The Pure Programming Language
Pure is a modern-style functional programming language based on term rewriting. It offers equational definitions with pattern matching, full symbolic rewriting capabilities, dynamic typing, eager and lazy evaluation, lexical closures, built-in list and matrix support and an easy-to-use C interface. The interpreter uses LLVM as a backend to JIT-compile Pure programs to fast native code.
Pure is the successor of the author's Q language. It offers many new and powerful features and programs run much faster than their Q equivalents. It also integrates nicely with a number of other computing environments, most notably Faust, Pure Data, Octave, Reduce and TeXmacs. A fairly extensive collection of addon modules is available, which makes Pure usable as a compiled scripting language for a variety of purposes.
Please also check out my personal Bitbucket page for more projects related to Pure.
A little code sample that prints the first 1000 Fibonacci numbers:
extern int puts(char*);
do (puts.str) (take 1000 (fibs 0L 1L)) with fibs a b = a : fibs b (a+b) & end;
You can execute this snippet by typing or pasting it at the Pure interpreter prompt. It uses the C
puts function to do the printing. Note that if you remove the
take 1000, all Fibonacci numbers will be printed (press
Ctrl-C when you get bored). An explanation of this example can be found in the Pure manual. More examples can be found here. (This points to the Examples section of the Pure manual which quickly gives you an idea how Pure programs look like.)
FreeBSD, GNU/Linux, Mac OS X and Windows are all known to work. Porting to other POSIX platforms should be a piece of cake. In principle Pure should be able to run on any system which is supported by LLVM.
The complete Pure Language and Library Documentation is available online (also in pdf format, 900+ pages). As the amount of information in the online manuals can be overwhelming, you may first want to check out the Pure Quick Reference guide (pdf, 80+ pages). It includes examples, references, index and an appendix with the Pure grammar and a brief introduction to term rewriting.
Additional pointers to documentation, related software, packages, ports and other resources can be found in the Wiki. Please also check the sidebar for a few selected wiki pages which should help you to get up and running quickly.
We have a mailing list at Google Groups and an IRC chat at Freenode (archived here; thanks yano!). Please join us there to discuss Pure and ask whatever questions you have. There's also a little weblog for release announcements and other newsworthy information.
Albert Gräf <aggraef at gmail.com>, Dept. of Computer Music, Johannes Gutenberg University of Mainz (Germany)