The Pure Programming Language

[Pure]

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.

NOTE: Pure has moved to Github. We still keep this Bitbucket site as a (read-only) archive, but all development happens on Github now. Please click here to go to the new website now.

Please also check out my personal Bitbucket page for more projects related to Pure.

EXAMPLES


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.)

The above is normal business in functional programming, but what about symbolic computation? For instance, here is a famous equation which you hopefully remember from high school algebra: (x+y)^2 = x^2+2*x*y+y^2; Again, you can just paste this line into the interpreter, and lo and behold, it just works in Pure:

> (a*x+(y+b))^2;
(a*x)^2+2*(a*x)*(y+b)+(y^2+2*y*b+b^2)

Now this might seem like an arcane feature, but many if not most real-world programming tasks involve a substantial amount of symbolic computations these days, and as a term rewriting language, Pure makes those easy. E.g., check the units.pure script in the sources for a practical example. (More examples from the sources can be found on the Examples wiki page.)

SUPPORTED SYSTEMS


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.

LICENSE


GNU Lesser General Public License V3 or later. Please see the documentation for details.

DOCUMENTATION


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. Also, the Examples section of the Pure manual can be used as a tutorial introduction to the language.

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.

COMMUNITY


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.

AUTHOR


Albert Gräf <aggraef at gmail.com>, Dept. of Computer Music, Johannes Gutenberg University of Mainz (Germany)

Copyright © 2007 Free Web Templates, Copyright © 2013-2017 Albert Gräf | XHTML | CSS