Look what I found!! This is an archive of what my site/life was about 4-5 years ago. For the modern JobyBednar.com, try here.
JobyBednar.com
The important thing is not to stop questioning.
- Albert Einstein

Ruby Development
/root
  ./apple I
  ./articles
  ./code
  ./decode
  ./hobbies
  ./mac
  ./pics
  ./ruby
  ./www



 Use OpenOffice.org
./Ruby/Continuations
---FILE: continuation.rb---

def checknext
   $queue.pop.call if $queue.size > 0
   puts "No Possible Matches"; exit 0
end

def choose(*args)
   $queue = [] if $queue.nil?
   callcc {|cont|  $queue << cont;  return args[rand(args.size)] }
   args.each {|x|  callcc {|cont|  $queue << cont;  return x } }
   checknext
end

def makesure(condition)
   if not condition
      checknext
   end
end

USE:

require 'continuation.rb'

a = choose(1,2,3,4,5)
b = choose(6,7,8,9)

makesure( a == b/2.0 )

puts "a:#{a} b:#{b}"  ==> a:3 b:6 or a:4 b:8

(use different makesure tests, or multiple tests to output different results)