From 785786c6033c97a70e78fb6b684d58aea18df4ae Mon Sep 17 00:00:00 2001 From: Chouser Date: Sun, 15 Feb 2015 17:44:52 -0500 Subject: forth: Finish step 4 --- forth/types.fs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'forth/types.fs') diff --git a/forth/types.fs b/forth/types.fs index 51f04ed..1a132be 100644 --- a/forth/types.fs +++ b/forth/types.fs @@ -118,7 +118,7 @@ MalType% deftype MalFalse MalFalse new constant mal-false : not-object? ( obj -- bool ) dup 7 and 0 <> if - drop -1 + drop true else 1000000 < endif ; @@ -232,7 +232,7 @@ def-protocol-method mal-count ( obj -- mal-int ) : m= ( a b -- bool ) 2dup = if - 2drop -1 + 2drop true else mal= endif ; @@ -293,16 +293,16 @@ MalList else 2dup MalList/count @ swap MalList/count @ over = if ( list-a list-b count ) -rot MalList/start @ swap MalList/start @ { start-b start-a } - -1 swap ( return-val count ) + true swap ( return-val count ) 0 ?do start-a i cells + @ start-b i cells + @ m= if else - drop 0 leave + drop false leave endif loop else - drop 2drop 0 + drop 2drop false endif endif ;; drop @@ -351,12 +351,12 @@ MalMap 0 begin dup count >= if - drop not-found -1 + drop not-found true else start over cells + @ k m= if - start swap cells + cell+ @ -1 \ found it ( value -1 ) + start swap cells + cell+ @ true \ found it ( value true ) else - 2 + 0 + 2 + false endif endif until ;; -- cgit v1.2.3