Discussion:
Searching the Forth Dictionary
(too old to reply)
Sidney Reilley
2025-01-01 01:15:48 UTC
Permalink
Eternal Forth noob here. Tired & retired but still at it.
I'm currently playing with pforth. I'm following along this video:
which is using swiftforth. He uses the
word `edit' <filename> to create a file.

Is it possible to search a Forth implementation's dictionary to see
if a particular words is built in - like `edit' in this case? TIA ..
--
Duke
** Bottom-posting, text-only is the netiquette way! **
dxf
2025-01-01 01:31:46 UTC
Permalink
Post by Sidney Reilley
Eternal Forth noob here. Tired & retired but still at it.
http://youtu.be/qZKXZifB39Y which is using swiftforth. He uses the
word `edit' <filename> to create a file.
Is it possible to search a Forth implementation's dictionary to see
if a particular words is built in - like `edit' in this case? TIA ..
' EDIT will report whether the word exists in the current search order.

The Standard has WORDS which displays all words. Many systems augment
that either by expanding WORDS to allow a pattern match, or a separate
word to do that. According to the pforth docs it has:

WORDS.LIKE <name>
Sidney Reilley
2025-01-01 01:52:56 UTC
Permalink
On Wed, 1 Jan 2025 12:31:46 +1100
Post by dxf
Post by Sidney Reilley
Eternal Forth noob here. Tired & retired but still at it.
I'm currently playing with pforth. I'm following along this
video: http://youtu.be/qZKXZifB39Y which is using swiftforth.
He uses the word `edit' <filename> to create a file.
Is it possible to search a Forth implementation's dictionary to
see if a particular words is built in - like `edit' in this
case? TIA ..
' EDIT will report whether the word exists in the current search order.
The Standard has WORDS which displays all words. Many systems
augment that either by expanding WORDS to allow a pattern match,
or a separate word to do that. According to the pforth docs it
WORDS.LIKE <name>
Many thanks! I installed pforth by cloning its from githup repo. No
docs in there. Where did you find the docs please? TIA ..
--
Duke
** Bottom-posting, text-only is the netiquette way! **
dxf
2025-01-01 02:10:02 UTC
Permalink
Post by Sidney Reilley
On Wed, 1 Jan 2025 12:31:46 +1100
Post by dxf
According to the pforth docs it
WORDS.LIKE <name>
Many thanks! I installed pforth by cloning its from githup repo. No
docs in there. Where did you find the docs please? TIA ..
https://www.softsynth.com/pforth/pf_ref.php

The source file is here:

https://github.com/philburk/pforth/blob/master/fth/wordslik.fth

Don't know if automatically included or whether you need to do it yourself.
Sidney Reilley
2025-01-01 02:25:09 UTC
Permalink
On Wed, 1 Jan 2025 13:10:02 +1100
Post by dxf
Post by Sidney Reilley
On Wed, 1 Jan 2025 12:31:46 +1100
Post by dxf
According to the pforth docs it
WORDS.LIKE <name>
Many thanks! I installed pforth by cloning its from githup
repo. No docs in there. Where did you find the docs please?
TIA ..
https://www.softsynth.com/pforth/pf_ref.php
https://github.com/philburk/pforth/blob/master/fth/wordslik.fth
Don't know if automatically included or whether you need to do it yourself.
Got it - thx! I need to get used to "the lay of the land" so to
speak. Anyway, pforth does not have an `edit' word built in. I
like the way swiftforth launches your default editor when calling
`edit <filename>' ! Thx again ...
--
Duke
** Bottom-posting, text-only is the netiquette way! **
a***@spenarnc.xs4all.nl
2025-01-01 14:48:15 UTC
Permalink
Post by Sidney Reilley
On Wed, 1 Jan 2025 13:10:02 +1100
Post by dxf
Post by Sidney Reilley
On Wed, 1 Jan 2025 12:31:46 +1100
Post by dxf
According to the pforth docs it
WORDS.LIKE <name>
Many thanks! I installed pforth by cloning its from githup
repo. No docs in there. Where did you find the docs please?
TIA ..
https://www.softsynth.com/pforth/pf_ref.php
https://github.com/philburk/pforth/blob/master/fth/wordslik.fth
Don't know if automatically included or whether you need to do it yourself.
Got it - thx! I need to get used to "the lay of the land" so to
speak. Anyway, pforth does not have an `edit' word built in. I
like the way swiftforth launches your default editor when calling
`edit <filename>' ! Thx again ...
I find it decreasingly useful to be able to do that.
My editor edits multiple files at the same time with
blindly fast switches. With a built in command to save one file,
that you are working on, it is way more convenient to start the
editor in a separate window.

Suppose you do
rlwrap myforth
...
rlwrap adds logging and command history and line editing to myforth.

My editor interprets ^C as 8 lines down. Before the ^C gets
to the editor, it is interpreted by rlwrap and it terminates
the whole shebang. Unpleasant things may happen with ^S ^Q ^D too.

I have a defining word OS-IMPORT for the situation that you
would run a command from the operating system:

"TYPE " OS-IMPORT cat
"ECHO " OS-IMPORT echo
"MORE< " OS-IMPORT more
\ "LIST " OS-IMPORT more
"DIR " OS-IMPORT ls
"COPY " OS-IMPORT cp
"DEL " OS-IMPORT rm
"EDIT " OS-IMPORT ed
"ee " OS-IMPORT ee \ My favorite editor
"" OS-IMPORT !!

Note that this is for windows, to behave like unix commands.
Post by Sidney Reilley
Duke
** Bottom-posting, text-only is the netiquette way! **
Groetjes Albert
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
a***@spenarnc.xs4all.nl
2025-01-01 14:00:30 UTC
Permalink
Post by Sidney Reilley
On Wed, 1 Jan 2025 12:31:46 +1100
Post by dxf
Post by Sidney Reilley
Eternal Forth noob here. Tired & retired but still at it.
I'm currently playing with pforth. I'm following along this
video: http://youtu.be/qZKXZifB39Y which is using swiftforth.
He uses the word `edit' <filename> to create a file.
Is it possible to search a Forth implementation's dictionary to
see if a particular words is built in - like `edit' in this
case? TIA ..
' EDIT will report whether the word exists in the current search order.
The Standard has WORDS which displays all words. Many systems
augment that either by expanding WORDS to allow a pattern match,
or a separate word to do that. According to the pforth docs it
WORDS.LIKE <name>
Many thanks! I installed pforth by cloning its from githup repo. No
docs in there. Where did you find the docs please? TIA ..
With all due respect, but why choose a Forth where you have no
documentation?

You have not looked very far.
If you install pforth on linux (as I did) you have a man page
that refers to http://www.softsynth.com/pforth/.
Plenty of documentation there.
Post by Sidney Reilley
--
Duke
** Bottom-posting, text-only is the netiquette way! **
Groetjes Albert
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
a***@spenarnc.xs4all.nl
2025-01-01 14:27:42 UTC
Permalink
Post by Sidney Reilley
Eternal Forth noob here. Tired & retired but still at it.
http://youtu.be/qZKXZifB39Y which is using swiftforth. He uses the
word `edit' <filename> to create a file.
Is it possible to search a Forth implementation's dictionary to see
if a particular words is built in - like `edit' in this case? TIA ..
The politically correct way is to use WORD and FIND.
Find returns a flag whether the word is found.

You also can type the word. If the Forth crashes, it is found.
(Probably you have not used it correctly.)
------------
~/PROJECT/ciforths/optim/ciforth: lina

80386 ciforth beta 2020Nov09
!
Segmentation fault (core dumped)
--------------
If the Forth stays alive without error, it is found.

It is system dependant, to find out if there is an error.
Some systems have the word "error" or "err" in the response.
A question sign is also in indication.
If you are lucky there is an identification of the error,
such as a number, that you can look up in the documentation.
Examples:

----------
ORANGUTAN
ORANGUTAN ? ciforth ERROR # 12 : NOT RECOGNIZED
----------
ORANGUTAN
ORANGUTAN ? - unrecognized word!
----------

123ORANG
123ORANG ? ciforth ERROR # 10 : NOT A WORD, NOR A NUMBER OR OTHER DENOTATION
----------

ORANGUTAN
:1: Undefined word
Post by Sidney Reilley
ORANGUTAN<<<
Backtrace:
$7FAF70A5CA68 throw
$7FAF70A72DD0 no.extensions
----------
ORANGUTAN ORANGUTAN ?
----------

ORANGUTAN
Err# -13 ERR: Undefined word.
-> ORANGUTAN
----------

Hopes this help. Experiment more.
Post by Sidney Reilley
--
Duke
** Bottom-posting, text-only is the netiquette way! **
Groetjes Albert
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
Loading...