2009-01-11から1日間の記事一覧
作った. # 前略 Maybe = algebraic(:nothing, :just, Object) def foo(y) puts match(y) { _(:just) {|x| "Just #{x}" } _ { "Nothing" } } end foo Maybe.new(:just, 42) foo Maybe.new(:nothing) Just 42 NothingCool!
作った. # 前略 Maybe = algebraic(:nothing, :just, Object) def foo(y) puts match(y) { _(:just) {|x| "Just #{x}" } _ { "Nothing" } } end foo Maybe.new(:just, 42) foo Maybe.new(:nothing) Just 42 NothingCool!