aboutsummaryrefslogtreecommitdiff
path: root/forth/core.fs
diff options
context:
space:
mode:
authorChouser <chouser@n01se.net>2015-02-15 17:44:52 -0500
committerChouser <chouser@n01se.net>2015-02-21 13:22:44 -0500
commit785786c6033c97a70e78fb6b684d58aea18df4ae (patch)
tree705ee89c9b7fd82aee10b70c15e285c38c388f86 /forth/core.fs
parentc4403c179e732a50e2b21a01469f0a38ea2d0187 (diff)
downloadmal-785786c6033c97a70e78fb6b684d58aea18df4ae.tar.gz
mal-785786c6033c97a70e78fb6b684d58aea18df4ae.zip
forth: Finish step 4
Diffstat (limited to 'forth/core.fs')
-rw-r--r--forth/core.fs23
1 files changed, 16 insertions, 7 deletions
diff --git a/forth/core.fs b/forth/core.fs
index 6dd4ec4..4982a0e 100644
--- a/forth/core.fs
+++ b/forth/core.fs
@@ -48,8 +48,8 @@ defcore not
endif
endif ;;
-: pr-str-multi ( argv argc )
- ?dup 0= if drop s" "
+: pr-str-multi ( readably? argv argc )
+ ?dup 0= if drop 0 0
else
{ argv argc }
new-str
@@ -60,8 +60,17 @@ defcore not
loop
endif ;
-defcore prn pr-str-multi type cr mal-nil ;;
-defcore pr-str pr-str-multi MalString. ;;
-
-defcore str drop @ pr-str MalString. ;;
-defcore println pr-str-multi 10 str-append-char MalString. ;;
+defcore prn true -rot pr-str-multi type cr drop mal-nil ;;
+defcore pr-str true -rot pr-str-multi MalString. nip ;;
+defcore println false -rot pr-str-multi type cr drop mal-nil ;;
+defcore str ( argv argc )
+ dup 0= if
+ MalString.
+ else
+ { argv argc }
+ false new-str
+ argc 0 ?do
+ argv i cells + @ pr-buf
+ loop
+ MalString. nip
+ endif ;;