Index: games/hangman/hangman.retro =================================================================== --- games/hangman/hangman.retro +++ games/hangman/hangman.retro @@ -14,11 +14,11 @@ include graphics.retro include dict.retro ( --[ Variables ]--------------------------------------------- ) -5 elements target guessed lifeline this-char foul-count +variables| target guessed lifeline this-char foul-count | stages constant lives ( see graphics.retro ) create foul-addr lives allot ( --[ Offset Calculation ]------------------------------------ ) Index: games/tic-tac-toe.rx =================================================================== --- games/tic-tac-toe.rx +++ games/tic-tac-toe.rx @@ -1,8 +1,8 @@ with canvas' -3 elements mx my color +variables| mx my color | : toggle dup @ not swap ! ; : player @color [ red ] [ blue ] if color toggle ; : drawBoard ( - ) Index: misc/bmi.rx =================================================================== --- misc/bmi.rx +++ misc/bmi.rx @@ -1,16 +1,25 @@ ( Body Mass Index Calculator ) ( Ported from Ron Aaron's Reva ) -2 elements height weight +variables| height weight | + : hello "\nBMI calculator 1.0\n" puts ; + +: ask ( $-n ) + "\nPlease enter your %s: " puts getToken toNumber ; + : getHeight - "\nPlease enter your height, in centimeters: " puts getToken toNumber !height ; + "height, in centimeters" ask !height ; + : getWeight - "\nPlease enter your weight in kilograms: " puts getToken toNumber !weight ; + "weight in kilograms" ask !weight ; + : showBMI @weight 100000 @height dup * &* dip / 10 /mod @height @weight "\nFor a weight of %d kg, and a height of %d cm, the BMI is %d.%d\n" puts ; + : getBMI hello getHeight getWeight showBMI bye ; + getBMI Index: util/extract-doc.rx =================================================================== --- util/extract-doc.rx +++ util/extract-doc.rx @@ -1,6 +1,6 @@ -2 elements in out +variables| in out | : seekDocBlock ( - ) [ @in ^files'readLine "doc{" compare not ] while ; : extractDocBlock ( - ) Index: util/grep.rx =================================================================== --- util/grep.rx +++ util/grep.rx @@ -1,10 +1,10 @@ ( "filename" "substring" grep ) ( display all lines containing "substring" in "filename" ) {{ - 2 elements token content + variables| token content | : clean ( $- ) withLength [ dup @ 10 13 within [ 999 swap &! sip ] ifTrue 1+ ] times drop ; @@ -18,12 +18,11 @@ here swap ^files'slurp here !content heap +! 32 , 0 , @content clean ; : eachLine ( $- ) [ getLine process dup 1 <> ] while drop ; - ---reveal--- : grep ( $$- ) cr keepString !token heap [ loadSourceData @content eachLine ] preserve ; }} Index: util/wc.rx =================================================================== --- util/wc.rx +++ util/wc.rx @@ -1,7 +1,7 @@ {{ - 3 elements content lines words + variables| content lines words | : clean ( $- ) withLength [ dup @ 10 13 within [ 999 swap &! sip ] ifTrue 1+ ] times drop ;