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:
f767595
)
Finished ROLL
author
Tim Vaughan
<tgvaughan@gmail.com>
Tue, 26 Apr 2016 21:01:56 +0000
(09:01 +1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Tue, 26 Apr 2016 21:01:56 +0000
(09:01 +1200)
src/lib.4th
patch
|
blob
|
history
diff --git
a/src/lib.4th
b/src/lib.4th
index
781a966
..
f4b28e6
100644
(file)
--- a/
src/lib.4th
+++ b/
src/lib.4th
@@
-170,10
+170,6
@@
@ ( and fetch )
;
-: ROLL ( x_u x_u-1... x_0 u -- x_u-1 ... x_0 x_u )
- 1+ DUP PICK SWAP ( x_u x_u-1 ... x_0 x_u u+1 )
-;
-
( With the looping constructs, we can now write SPACES, which writes n spaces to stdout. )
: SPACES ( n -- )
0 DO
@@
-316,3
+312,13
@@
THEN
;
+: ROLL ( x_u x_u-1... x_0 u -- x_u-1 ... x_0 x_u )
+ 1+ DUP PICK SWAP ( x_u x_u-1 ... x_0 x_u u+1 )
+ PSP@ 1- SWAP - PSP@ 2- SWAP
+ DO
+ i 1+ @ i !
+ LOOP
+ SWAP DROP
+;
+
+