From c7d3d7f457bc6c4a5a3a3d0d6f8779aa46b63779 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 5 Jul 2021 01:15:01 -0400 Subject: [PATCH] forbble stability and usability --- src/examples/forbble.pbl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/examples/forbble.pbl b/src/examples/forbble.pbl index 6a20c8b..85792b3 100755 --- a/src/examples/forbble.pbl +++ b/src/examples/forbble.pbl @@ -88,11 +88,13 @@ ; Defines a given symbol using a given list of Forth inputs (def compile (fn (func sym) ( + ; Get next symbol (def _x (at 0 func)) - (if (= _x "$") (rest func) + (if (iserr _x) _x + (if (= _x "$") (rest func) (at 1 ( (defe sym (ap (eval sym) _x)) - (compile (rest func) sym)) + (compile (rest func) sym))) ))))) ; Evaluate a list of Forth inputs @@ -143,9 +145,10 @@ ; Basic imperial distances (feval (: "ft" 12 * $)) (feval (: "yd" ft 3 * $)) +(feval (: "yds" yd $)) (feval (: "in" $)) -(feval (: "i>f" 1 ft / $)) -(feval (: "i>y" 1 yd / $)) +(feval (: ">ft" 1 ft / $)) +(feval (: ">yds" 1 yd / $)) ; Convert between Farenheit and Celcius (feval (: "f>c" 32 - 5 * 9 /$))