Skip to content
Albert Graef edited this page Mar 26, 2017 · 6 revisions

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.

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.

  • There's an alternative set of documentation files (html, pdf) generated from Markdown with Pandoc, but at present it's still a bit experimental and lacks some features of the "official" documentation above. (While Markdown may be the way of the future, it has some limitations when creating large collections of interconnected programming manuals, so the Pure documentation still relies on the older RST format and Python's Sphinx document generation system right now.)

  • 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.
  • 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.
  • Packages for various Ubuntu releases are available on Launchpad, please check the Pure on Ubuntu wiki page for details.
  • Outdated Fedora packages by Michel Salim are available in the usual repositories, see here.
  • Outdated openSUSE packages for Pure and some of its modules are maintained at the openSUSE Build Service. You can download them here.
  • Outdated A FreeBSD port by Zhihao Yuan is available here.

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++.
  • Alastair Pharo's pure-opencl is an interface to the OpenCL API from Pure.
  • An interview about Pure conducted by Nick Mudge can be found here. (This is an archive.is capture of a Wayback Machine archive of the original site. Unfortunately 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.

Author

Albert Gräf
Dept. of Computer Music
Johannes Gutenberg University of Mainz (Germany)

Clone this wiki locally