Skip to content

Commit

Permalink
Implement or
Browse files Browse the repository at this point in the history
  • Loading branch information
mocoso committed Apr 28, 2014
1 parent 23d09ca commit c054cf3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/list.rb
Expand Up @@ -24,6 +24,8 @@ def evaluate(env)
arguments.first
when :cond
arguments.detect { |list| list.car.evaluate(env) == Atom::TRUE }.cdr.car.evaluate(env)
when :or
arguments.first.evaluate(env) == Atom::TRUE ? Atom::TRUE : arguments.last.evaluate(env)
else
first_argument, *other_arguments = arguments.map { |a| a.evaluate(env) }
first_argument.send(operation, *other_arguments)
Expand Down

0 comments on commit c054cf3

Please sign in to comment.