Fixed broken realnum? procedure.
authorTim Vaughan <tgvaughan@gmail.com>
Wed, 12 Oct 2016 10:20:57 +0000 (23:20 +1300)
committerTim Vaughan <tgvaughan@gmail.com>
Wed, 12 Oct 2016 10:20:57 +0000 (23:20 +1300)
scheme.4th

index bac3283..46c2969 100644 (file)
@@ -513,16 +513,16 @@ parse-idx-stack parse-idx-sp !
 ;
 
 : realnum? ( -- bool )
-    \ Record starting parse idx:
-    \ Want to detect whether any characters were eaten.
-    parse-idx @
-
     push-parse-idx
 
     minus? plus? or if
         inc-parse-idx
     then
 
+    \ Record starting parse idx:
+    \ Want to detect whether any characters (following +/-) were eaten.
+    parse-idx @
+
     begin digit? while
             inc-parse-idx
     repeat
@@ -541,6 +541,10 @@ parse-idx-stack parse-idx-sp !
             inc-parse-idx
         then
 
+        digit? invert if
+            drop pop-parse-idx false exit
+        then
+
         begin digit? while
                 inc-parse-idx
         repeat