diff options
| -rw-r--r-- | state.rb | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -5,6 +5,17 @@ Author: Casey Dahlin <cjdahlin@ncsu.edu> =end require 'set' +unless Array.instance_methods.include? "product" + class Array #:nodoc: + def product(*others) + return self.map{ |x| [x] } if others.size == 0 + self.map do |x| + (others[0].product(*others[1..-1])).map{ |y| [x] + y } + end.inject([]){ |x,y| x+y } + end + end +end + module UpState # Occurs when the state machine becomes inconsistent |
