This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fiber' | |
class Fiber | |
def map &block | |
Fiber.new { loop { Fiber.yield block.call(resume) } } | |
end | |
def to_a | |
[].tap{|xs| xs << resume while alive?} |
NewerOlder