lib/lisp/interpreter/core/object.rb in lisp-interpreter-0.4.4 vs lib/lisp/interpreter/core/object.rb in lisp-interpreter-0.5.0
- old
+ new
@@ -39,16 +39,12 @@
def boolean?
['#t', '#f'].include? self
end
def type
- return '<list>' if list?
- return '<pair>' if pair?
- return '<string>' if string?
- return '<number>' if number?
- return '<character>' if character?
- return '<boolean>' if boolean?
- '<quote>'
+ fns = %w[list pair string number character boolean quote]
+ res = fns.reject { |t| fns.index(t) unless send t + '?' }
+ '<' + res[0] + '>'
end
private
def object_split