From aad554fc41d2b418e63b4320e8f793f28ffac6bf Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Tue, 25 Oct 2016 16:57:32 +1300 Subject: [PATCH] Load now returns result of last expression. --- scheme.4th | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scheme.4th b/scheme.4th index b2efe17..7626be8 100644 --- a/scheme.4th +++ b/scheme.4th @@ -1412,21 +1412,24 @@ include scheme-primitives.4th swap - ; -: load ( addr n -- ) +: load ( addr n -- finalResult ) open-input-file empty-parse-str + ok-symbol ( port res ) + begin - 2dup read-port + 2over read-port ( port res obj ) 2dup EOF character-type objeq? if - 2drop close-port + 2drop 2swap close-port exit then - global-env obj@ eval - 2drop + 2swap 2drop ( port obj ) + + global-env obj@ eval ( port res ) again ; @@ -1458,7 +1461,7 @@ include scheme-primitives.4th ; : test s" fact.scm" ; -test load +test load 2drop forth definitions -- 2.20.1