fix many uses of deprecated names (thanks john_cephalopoda) [first of a few patched related to this]

FossilOrigin-Name: faa0b6ed0fa09b4307285cfc8a6172762636285bb7864e64cff2995e4d9ba324
This commit is contained in:
crc 2020-09-30 23:02:23 +00:00
parent 4b8c651bf2
commit c676b83793
8 changed files with 18 additions and 17 deletions

View file

@ -16,7 +16,7 @@ and traditional Forth.
| Conditionals #2 | `NOT IF 1 THEN` | `[ #1 ] -if` |
| Conditionals #3 | `IF 1 ELSE 2 THEN` | `[ #1 ] [ #2 ] choose` |
| Counted Loops | `10 0 DO LOOP` | `#10 [ ] times` |
| Counted Loops w/Index | `10 0 DO I LOOP` | `#10 [ I ] times<with-index>` |
| Counted Loops w/Index | `10 0 DO I LOOP` | `#10 [ I ] indexed-times` |
| Unconditional Loops | `BEGIN AGAIN` | `repeat again` |
| Return Stack | `10 >R ... R>` | `#10 push ... pop` |

View file

@ -5,14 +5,14 @@ static global environment.* This can be difficult to explain, so let's
take a quick look at how it works:
~~~
#1000 'a var<n>
#1000 'a var-n
:scale (x-y) @a * ;
#3 scale n:put
>>> 3000
#100 !a
#3 scale n:put
>>> 300
#5 'a var<n>
#5 'a var-n
#3 scale n:put
>>> 300
@a n:put

View file

@ -39,19 +39,19 @@ when to stop running.
## Counted Loops
There are two combinators for counted loops. These are `times` and
`times<with-index>`.
`indexed-times`.
#0 #10 [ dup n:put sp n:inc ] times nl
#10 [ I n:put sp ] times<with-index>
#10 [ I n:put sp ] indexed-times
The `times<with-index>` provides an index via the `I`, `J`, and
The `indexed-times` provides an index via the `I`, `J`, and
`K` words. `I` will be the index of the current loop, with `J` and
`K` being the indexes of the next two older loops.
The loop indexes can be accessed outside the loop body:
:display I n:square n:put sp ;
:squares [ display ] times<with-index> nl ;
:squares [ display ] indexed-times nl ;
#100 squares
## Tradeoffs
@ -59,5 +59,5 @@ The loop indexes can be accessed outside the loop body:
The unconditional loop form is more efficient as it's just a
simple jump operation. The `times` counted loops are a little
slower, but can be cleaner and more readable in many cases. The
`times<with-index>` form is significantly slower than the other
`indexed-times` form is significantly slower than the other
two forms.

View file

@ -121,12 +121,12 @@ to the stack.
#1 #10 [ dup n:put sp n:inc ] times drop
```
There is also a `times<with-index>` variation that provides
There is also a `indexed-times` variation that provides
access to the loop index (via `I`) and parent loop indexes
(via `J` and `K`).
```
#10 [ I n:put sp ] times<with-index>
#10 [ I n:put sp ] indexed-times
```
## Data Flow

View file

@ -184,7 +184,7 @@ It should be pretty straightforward though.
| pos | 'Stack:_ s:put dump-stack ;
:format | call | nl ;
:line [ #64 [ fetch-next c:put ] times ] format ;
:code &Block #16 [ line ] times<with-index> drop ;
:code &Block #16 [ line ] indexed-times drop ;
:tob &TOB #4 [ line ] times drop ;
---reveal---
:block:display (-) hook
@ -366,7 +366,7 @@ These are helpful to quickly navigate through a block.
## Code Sharing
~~~
TRUE 'UseSprunge var<n>
TRUE 'UseSprunge var-n
{{
'/home/crc/public 'PASTEBIN-PATH s:const
@ -376,8 +376,8 @@ TRUE 'UseSprunge var<n>
:c:put<file> @FID file:write ;
:line# I dup #10 lt? &sp if n:put ':_ s:put ;
:line line# #64 [ fetch-next c:put ] times nl ;
:generate &Block #16 [ line ] times<with-index> drop ;
:export TEMPFILE file:open<for-writing> !FID
:generate &Block #16 [ line ] indexed-times drop ;
:export TEMPFILE file:open-for-writing !FID
&c:put<file> &c:put set-hook generate
&c:put unhook @FID file:close ;
'MD5 var

View file

@ -11,7 +11,8 @@ It's intentionally kept minimal, handling only text files and directories. The i
There is also a `Results` variable which will point to the data set being displayed.
~~~
#34 'WrapPoint var<n>
#34 'WrapPoint var-n
'Results var
'TARGET d:create #1024 #64 * allot
~~~

View file

@ -85,7 +85,7 @@ Then variables.
~~~
:variable?
dup 'var s:ends-with? over 'var<n> s:ends-with? or ;
dup 'var s:ends-with? over 'var-n s:ends-with? or ;
:output-name
ASCII:SPACE s:tokenize dup a:length #2 - a:fetch n:inc s:put ;

View file

@ -177,7 +177,7 @@ It should be pretty straightforward though.
:status block# sp pos '_::_ s:put dump-stack ;
:format '_|_ s:put call '_| s:put nl ;
:line [ #64 [ fetch-next c:put ] times ] format ;
:code &Block #16 [ line ] times<with-index> drop ;
:code &Block #16 [ line ] indexed-times drop ;
:format '_|_ s:put call '_| s:put nl ;
:tob &TOB #4 [ line ] times drop ;
---reveal---