From 3cb684840a00f1e1e2af41c8b1b0f69c2f1557eb Mon Sep 17 00:00:00 2001 From: vonhyou Date: Wed, 14 Apr 2021 08:56:12 +0800 Subject: [PATCH] format --- minlisp.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/minlisp.rb b/minlisp.rb index 423ccac..338ba9e 100644 --- a/minlisp.rb +++ b/minlisp.rb @@ -44,17 +44,16 @@ end def atom(token) # Analyse numbers and symbols - isInteger = ->(atom) { atom.match?(/^-?\d+$/) } - isFloat = ->(atom) { atom.match?(/^(-?\d+)(\.\d+)?$/) } - return Integer token if isInteger.call token - return Float token if isFloat.call token + is_integer = ->(atom) { atom.match?(/^-?\d+$/) } + is_float = ->(atom) { atom.match?(/^(-?\d+)(\.\d+)?$/) } + return Integer token if is_integer.call token + return Float token if is_float.call token token.to_sym end # p parse '(def 1 2 (c 3.3 (r f r) e))' - ##### Environments def generate_env