updates to some examples

FossilOrigin-Name: 6efdcd9c4a9455a2f908fa727dae442aee8f7c3e5a5d6c4d09f1ad53960d9d89
This commit is contained in:
crc 2018-06-20 13:03:22 +00:00
parent 522555a96e
commit 9b5212cb45
4 changed files with 11 additions and 16 deletions

View file

@ -10,7 +10,7 @@ This is an example adding two three element vectors.
A test case:
~~~
```
'a d:create #1 , #2 , #3 ,
'b d:create #2 , #3 , #4 ,
'c d:create #3 allot
@ -20,5 +20,5 @@ A test case:
&c fetch-next n:put nl
fetch-next n:put nl
fetch n:put nl
~~~
```

View file

@ -1,8 +1,7 @@
#/bin/sh
#!/bin/sh
stty cbreak
cat >/tmp/_roo.forth << 'EOF'
# Roo: A Block Editor for RETRO
This implements a block editor for RETRO. It provides a visual interface,
@ -51,7 +50,6 @@ the currently loaded block.
~~~
## Server Communication
With that done, it's now time for a word to load a block from the
@ -80,13 +78,12 @@ And then words to actually talk to the server:
~~~
:load-block (-) &Block SERVER selector<get> gopher:get drop ;
:save-block (-) here SERVER selector<set> gopher:get drop ;
:save-block (-) here SERVER selector<set> gopher:get drop ;
~~~
All done :)
## Modes
The `Mode` variable will be used to track the current mode. I have
@ -105,7 +102,6 @@ $C 'Mode var<n>
~~~
## Cursor & Positioning
I need a way to keep track of where in the block the user currently is.
@ -150,7 +146,6 @@ The last bit here is `insert-character` which inserts a character to
~~~
## Keyboard Handling
Handling of keys is essential to using Roo. I chose to use a method that
@ -251,7 +246,6 @@ if editing is finished.
~~~
## Display
The block display is kept minimalistic. Each line is bounded by a single
@ -302,7 +296,6 @@ The cursor display will be platform specific.
~~~
## The Final Piece
All that's left is a single top level loop to tie it all together.
@ -317,6 +310,7 @@ edit
~~~
EOF
rre /tmp/_roo.forth
rm -f /tmp/_roo.forth

View file

@ -35,8 +35,8 @@ This removes the primitive stack shuffling, and leaves something that expresses
Finally, here's a little test case:
```
#10 'foo acc
foo
foo
foo
#10 'foo acc
foo
foo
foo
```

View file

@ -12,7 +12,8 @@ and compare them.
~~~
:s:palindrome? (s-f)
dup s:hash [ s:reverse s:hash ] dip eq? ;
[ s:hash ]
[ s:reverse s:hash ] bi eq? ;
'ingirumimusnocteetconsumimurigni s:palindrome?
~~~