From efcae7affe8a5106424a7f0b67a1fd550e8cb320 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Wed, 27 Apr 2016 07:38:43 +1200 Subject: [PATCH 1/1] Working on ROLL, redefined SPACES --- src/lib.4th | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lib.4th b/src/lib.4th index 51f0b97..1f97d20 100644 --- a/src/lib.4th +++ b/src/lib.4th @@ -170,16 +170,15 @@ @ ( 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 -- ) - BEGIN - DUP 0> ( while n > 0 ) - WHILE - SPACE ( print a space ) - 1- ( until we count down to 0 ) - REPEAT - DROP + 0 DO + SPACE + LOOP ; ( Standard words for manipulating BASE. ) -- 2.20.1