From: Tim Vaughan Date: Tue, 25 Oct 2016 03:57:32 +0000 (+1300) Subject: Load now returns result of last expression. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=scheme.forth.jl.git;a=commitdiff_plain;h=aad554fc41d2b418e63b4320e8f793f28ffac6bf Load now returns result of last expression. --- 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