diff options
| author | Chouser <chouser@n01se.net> | 2015-02-15 17:44:52 -0500 |
|---|---|---|
| committer | Chouser <chouser@n01se.net> | 2015-02-21 13:22:44 -0500 |
| commit | 785786c6033c97a70e78fb6b684d58aea18df4ae (patch) | |
| tree | 705ee89c9b7fd82aee10b70c15e285c38c388f86 /forth/types.fs | |
| parent | c4403c179e732a50e2b21a01469f0a38ea2d0187 (diff) | |
| download | mal-785786c6033c97a70e78fb6b684d58aea18df4ae.tar.gz mal-785786c6033c97a70e78fb6b684d58aea18df4ae.zip | |
forth: Finish step 4
Diffstat (limited to 'forth/types.fs')
| -rw-r--r-- | forth/types.fs | 16 |
1 files changed, 8 insertions, 8 deletions
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 ;; |
