aboutsummaryrefslogtreecommitdiff
path: root/forth/types.fs
diff options
context:
space:
mode:
authorChouser <chouser@n01se.net>2015-02-19 18:34:59 -0500
committerChouser <chouser@n01se.net>2015-02-21 13:22:44 -0500
commit6512bd80002eb106a304b035e9592847d90ef23c (patch)
treea6fd47e87c6f0762e556f42364bca7945e74c324 /forth/types.fs
parent224e09ed42325f000ee9a31a500bebe03a1ba97c (diff)
downloadmal-6512bd80002eb106a304b035e9592847d90ef23c.tar.gz
mal-6512bd80002eb106a304b035e9592847d90ef23c.zip
forth: Self-hosted mal passes all tests
Diffstat (limited to 'forth/types.fs')
-rw-r--r--forth/types.fs31
1 files changed, 18 insertions, 13 deletions
diff --git a/forth/types.fs b/forth/types.fs
index 1ce74d9..b936603 100644
--- a/forth/types.fs
+++ b/forth/types.fs
@@ -317,21 +317,25 @@ MalList
extend empty? MalList/count @ 0= mal-bool ;;
extend mal-count MalList/count @ MalInt. ;;
extend mal=
- swap to-list dup 0= if
- nip
+ over mal-nil = if
+ 2drop false
else
- 2dup MalList/count @ swap MalList/count @ over = if ( list-a list-b count )
- -rot MalList/start @ swap MalList/start @ { start-b start-a }
- true swap ( return-val count )
- 0 ?do
- start-a i cells + @
- start-b i cells + @
- m= if else
- drop false leave
- endif
- loop
+ swap to-list dup 0= if
+ nip
else
- drop 2drop false
+ 2dup MalList/count @ swap MalList/count @ over = if ( list-a list-b count )
+ -rot MalList/start @ swap MalList/start @ { start-b start-a }
+ true swap ( return-val count )
+ 0 ?do
+ start-a i cells + @
+ start-b i cells + @
+ m= if else
+ drop false leave
+ endif
+ loop
+ else
+ drop 2drop false
+ endif
endif
endif ;;
drop
@@ -434,6 +438,7 @@ MalDefault
extend to-list drop 0 ;;
extend empty? drop mal-true ;;
extend sequential? drop mal-false ;;
+ extend mal= = ;;
drop
MalNil