From 5c89ece636005a3008eb27a80b0c805b4d0e4c84 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Mon, 19 Jun 2017 22:27:16 +1200 Subject: [PATCH] Updated readme. --- README.md | 16 ++++++++++------ src/scheme-library.scm | 7 +++++++ src/scheme-primitives.4th | 9 ++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 52b4b6f..0a861b9 100644 --- a/README.md +++ b/README.md @@ -75,8 +75,15 @@ You'll then be greeted by the following prompt: ;; M-Eval input: At this point you can start entering Scheme commands... but be prepared to wait -a _long_ time for the result. For instance, the following example from SICP -defines and demonstrates a recursive list append procedure: +a while for the result. After all, when evaluating commands in the MCE you are +running a program in a Scheme interpreter running inside another Scheme +interpreter which is itself running on a Forth system that is implemented atop +the Julia numerical computing environment. **That's three levels of +abstraction more than a native Julia program experiences**, so some delay is to +be expected! + +For instance, the following example from SICP defines and demonstrates a +recursive list append procedure: (define (append x y) (if (null? x) @@ -93,10 +100,7 @@ defines and demonstrates a recursive list append procedure: ;;; M-Eval value: (a b c d e f) -Be prepared to wait 20 min or more for the final result to be printed. (Given -that at this point we have a program running in a Scheme interpreter running -inside another Scheme interpreter which is itself running on a Forth system -that is implemented in Julia, this should not be a surprise.) +You may have to wait a minute or so for the final result to be printed. License ======= diff --git a/src/scheme-library.scm b/src/scheme-library.scm index 67ab483..78414ac 100644 --- a/src/scheme-library.scm +++ b/src/scheme-library.scm @@ -122,6 +122,10 @@ (expand-or-expressions expressions)) )) +;; not + +(define-macro (not x) + `(if ,x #f #t)) ;; FUNCTIONAL PROGRAMMING @@ -314,6 +318,9 @@ ;; LISTS +; List creation +(define (list . args) args) + ; Return number of items in list (define (length l) (define (iter a count) diff --git a/src/scheme-primitives.4th b/src/scheme-primitives.4th index 493f256..1e37e0d 100644 --- a/src/scheme-primitives.4th +++ b/src/scheme-primitives.4th @@ -611,7 +611,14 @@ defer display nil? if ." Error." else - ." Error: " car display + ." Error: " + + begin + 2dup car print + cdr nil? + until + + 2drop then reset-term -- 2.20.1