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.)
- Mac OS X
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.
Documentation and Examples
This is the full documentation with all the gory details (currently at 900+ pages). You can also read this as online documentation with the
helpcommand 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)
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.
- Release tarballs
- Git repository
- Snapshot tarballs from the Git sources
- Old releases at GoogleCode and even older (historic) releases at SourceForge
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
- pure-lang-extras provides additional libraries for Pure as well as a project template for Pure module developers, by Michael Maul.
- pure-vision is an OpenCV module for Pure, by Kay-Uwe Kirstein.
- Interesting bits of Pure code including an Ogg Vorbis player at Bluish Coder blog, by Chris Double.
- Other interesting bits of Pure code by dubiousjim, such as an implementation of 2-3 trees and weak references and dictionaries.
- Dogan Ulus' timed regular expression matcher Montre is written in Pure and C++.
- An interview with the creator of Pure conducted by Nick Mudge can be found at http://web.archive.org/web/20120502103659/http://blueparen.com/node/7. (Wayback link as Nick's blueparen website has disappeared from the web.)
- Other interesting items such as programming modes and syntax highlighting files can be found on the Grab Bag page.
Albert Gräf <aggraef at gmail.com>
Dept. of Computer Music
Johannes Gutenberg University of Mainz (Germany)