This file contains 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
IO.stream(:line) | |
|> Stream.map(&String.trim_trailing/1) | |
|> Enum.reduce(%{}, fn | |
"list", todo -> IO.inspect(todo) | |
"add " <> item, todo -> Map.put(todo, item, false) | |
"complete " <> item, todo -> Map.put(todo, item, true) | |
"delete " <> item, todo -> Map.delete(todo, item) | |
end) |
This file contains 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
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0] | |
~> ruby foo.rb | |
hello! | |
~> rvm use jruby | |
Using /Users/mperham/.rvm/gems/jruby-1.6.0 | |
~> jruby -v | |
jruby 1.6.0 (ruby 1.8.7 patchlevel 330) (2011-03-15 f3b6154) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java] | |
~> jruby foo.rb | |
NoMethodError: undefined method `synchronize' for nil:NilClass | |
timed_pop at foo.rb:5 |