Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tag: r0.4.1
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (22 sloc) 0.601 kB
# Computes Pascals triangle using procrastinate. This is mainly a stress test
# for result handling code and is NOT how I would parallelize this task!
$:.unshift File.dirname(__FILE__) + '/../lib'
require 'procrastinate'
require 'procrastinate/implicit'
include Procrastinate
V = Struct.new(:value) do
def ready?; true; end
end
current = [
V.new(1),
V.new(1)
]
loop do
last = current
puts last.map { |e| sprintf("%3d", e.value) }.join(' ')
current = [V.new(1)] +
last.each_cons(2).map { |l,r|
Procrastinate.schedule { l.value + r.value }
} +
[V.new(1)]
end
Jump to Line
Something went wrong with that request. Please try again.