Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Automatic parallelism and lazy evaluation using pure functional programming in Ruby.
Ruby
Tree: c9e21cd9fe

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
devel
lib
spec
CHANGES.rdoc
README.rdoc
Rakefile
install.rb

README.rdoc

Pure

Summary

Language-level support for automatic parallelism and lazy evaluation.

Synopsis

require 'pure'
include Pure

geometry = pure do
  def area(width, height)
    width*height
  end

  def width(border)
    7 + border
  end

  def height(border)
    5 + border
  end

  def border
    2
  end
end

# compute the area using 3 parallel threads
puts geometry.compute(:area, :threads => 3)
# => 63

# We've done this computation.
puts((7 + 2)*(5 + 2))
# => 63

Description

Pure is an importation of the pure functional paradigm into Ruby.

Method names and argument names have lexicographical meaning within a pure block. Above, the width argument to area corresponds by its literal name to the width method, for example.

pure returns a module which may be included into other pure blocks.

Implementation details are placed inside Pure::PurePrivate, making include Pure a hygienic operation.

Pure does not modify any of the standard classes.

Implementation

The “ripper” parser is used if it exists, otherwise ruby_parser is used.

Pure has been tested on MRI 1.8.6, 1.8.7, 1.9.1 and the latest jruby.

Something went wrong with that request. Please try again.