1. PureLang
  2. Pure
  3. pure-lang

Wiki

Clone wiki

pure-lang / Home

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, PureData, 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.

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

Supported Systems

  • FreeBSD
  • GNU/Linux
  • Mac OS X
  • Windows

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 and Examples

  • Pure Language and Library Documentation (html, pdf, tarball)

    This is the full documentation with all the gory details (currently at 900+ pages). You can also read this as online documentation with the help command in the interpreter. This is intended primarily as a reference manual, although you may want to at least skim through The Pure Manual to pick up the language. In particular, the Examples section of the Pure Manual can be used as a Pure tutorial.

  • Pure Quick Reference (pdf)

    This is a quick guide to Pure for the impatient (80+ pages) which explains the most important parts of the language. Includes examples, references, index and an appendix with the Pure grammar and a brief introduction to term rewriting. This is what you should read first if the amount of information in the reference documentation seems overwhelming.

  • The Pure TeXmacs Plugin (pdf)

    A guide to using Pure with Octave, Reduce and TeXmacs. Read this if you'd like to use Pure as a scientific computing environment, or if you just want to use TeXmacs as a convenient frontend to Pure.

  • README, INSTALL and NEWS files of the Pure interpreter.

Selected wiki pages:

  • Getting started: a quick guide to installing and using the Pure interpreter
  • The FAQ: frequently asked questions with answers
  • Programming examples: some typical code examples from the distribution
  • Addons: an overview of addon modules and libraries for Pure
  • Roadmap: major items to be tackled in future Pure releases

Click here for a list of all wiki pages.

Mailing List and Chat

Pure development and use is discussed on the mailing list. Join us there to discuss Pure and ask whatever questions you have.

We also have a #pure-lang IRC channel on freenode, which is archived here (thanks, yano!). To use this, point your IRC client at irc.freenode.net, or else use the page at http://webchat.freenode.net from your browser.

Source Code

Packages and Ports

  • Windows installers for Pure and several addons are available in the Downloads section.
  • MacPorts provides a complete collection of ports for Pure and all its addon modules maintained by Ryan Schmidt. Please check the Pure on Mac OS X wiki page for details.
  • The Homebrew package manager for Mac OS X also has a recipe a.k.a. formula by Michael Kohl for building Pure.
  • Fedora packages by Michel Salim are available in the usual repositories, see here. Additional packages for Fedora users by Fernando Lopez-Lezcano can be found in the Planet CCRMA repositories.
  • openSUSE packages for Pure and some of its modules are maintained at the openSUSE Build Service. You can download them here.
  • A complete set of Pure packages by Björn Lindig, Alastair Pharo and others for Arch Linux is available in the AUR, please check the Pure on Arch Linux wiki page for details..
  • A FreeBSD port by Zhihao Yuan is available here.
  • Packages for various Ubuntu releases are available on Launchpad. There are several PPAs, one with the interpreter and all addon modules, and a few others with packages of 3rd party software which can be used with Pure, such as Faust and Gnocl.

Pure on the Web

Author

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

Updated