The Lambda Lab
/
projects
/
forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9ff796f
)
Added LOOP+ and expressed LOOP as a special case.
author
Tim Vaughan
<tgvaughan@gmail.com>
Tue, 26 Apr 2016 09:33:11 +0000
(21:33 +1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Tue, 26 Apr 2016 09:33:11 +0000
(21:33 +1200)
src/lib.4th
patch
|
blob
|
history
diff --git
a/src/lib.4th
b/src/lib.4th
index
c9e07bf
..
f4e9908
100644
(file)
--- a/
src/lib.4th
+++ b/
src/lib.4th
@@
-112,14
+112,19
@@
: I RSP@ 2- @ ;
-: LOOP IMMEDIATE
- ' R> , ' R> , '
1
+ , ' 2DUP , ' - ,
+: LOOP
+
IMMEDIATE
+ ' R> , ' R> , '
-ROT , '
+ , ' 2DUP , ' - ,
' SWAP , ' >R , ' SWAP , ' >R ,
' 0<= , ' 0BRANCH ,
HERE @ - ,
' RDROP , ' RDROP ,
;
+: LOOP IMMEDIATE
+ ' LIT , 1 ,
+ [COMPILE] LOOP+
+;
+
\ COMMENTS ----------------------------------------------------------------------