Skip to content

Commit

Permalink
Implement zero?
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislo committed Jun 2, 2014
1 parent de0ced4 commit fc43cce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/atom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ def sub1
raise unless result.number?
end
end

def zero?
symbol == :'0' ? TRUE : FALSE
end
end
1 change: 1 addition & 0 deletions lib/evaluator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def apply(env, arguments)
null?: Primitive.new(:null?),
atom?: Primitive.new(:atom?),
eq?: Primitive.new(:eq?),
zero?: Primitive.new(:zero?),
add1: Primitive.new(:add1),
sub1: Primitive.new(:sub1)
}
Expand Down

0 comments on commit fc43cce

Please sign in to comment.