From 1a74d57182085535faef901d6940874bea3ad3c6 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Tue, 25 Oct 2016 17:03:54 +1300 Subject: [PATCH] Added load primitive. --- fact.scm | 8 -------- scheme.4th | 12 +++++++++--- 2 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 fact.scm diff --git a/fact.scm b/fact.scm deleted file mode 100644 index 0991511..0000000 --- a/fact.scm +++ /dev/null @@ -1,8 +0,0 @@ -; Demo scheme source file. - -(define (fact n) - (if (= n 0) - 1 - (* n (fact (- n 1))))) - -; Done! diff --git a/scheme.4th b/scheme.4th index 7626be8..0a237da 100644 --- a/scheme.4th +++ b/scheme.4th @@ -1433,6 +1433,15 @@ include scheme-primitives.4th again ; +:noname ( args -- finalResult ) + 2dup 1 ensure-arg-count + car string-type ensure-arg-type + + drop pair-type + pad charlist>cstr + pad swap load +; make-primitive load + \ }}} \ ---- REPL ---- @@ -1460,9 +1469,6 @@ include scheme-primitives.4th again ; -: test s" fact.scm" ; -test load 2drop - forth definitions \ vim:fdm=marker -- 2.20.1