• Re: Searching the Forth Dictionary

    From albert@spenarnc.xs4all.nl@21:1/5 to sidney.reilley.ii@gmail.com on Wed Jan 1 15:00:30 2025
    In article <20241231185256.1ae04c7aa9c7b24a19e39956@gmail.com>,
    Sidney Reilley <sidney.reilley.ii@gmail.com> wrote:
    On Wed, 1 Jan 2025 12:31:46 +1100
    dxf <dxforth@gmail.com> wrote:

    On 1/01/2025 12:15 pm, Sidney Reilley wrote:
    Eternal Forth noob here. Tired & retired but still at it.
    I'm currently playing with pforth. I'm following along this
    video: https://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>

    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.

    --
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to sidney.reilley.ii@gmail.com on Wed Jan 1 15:27:42 2025
    In article <20241231181548.1b36ff52e0c2e65596672f3c@gmail.com>,
    Sidney Reilley <sidney.reilley.ii@gmail.com> wrote:
    Eternal Forth noob here. Tired & retired but still at it.
    I'm currently playing with pforth. I'm following along this video: >https://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

    ORANGUTAN<<<
    Backtrace:
    $7FAF70A5CA68 throw
    $7FAF70A72DD0 no.extensions
    ----------
    ORANGUTAN ORANGUTAN ?
    ----------

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

    Hopes this help. Experiment more.

    --
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From albert@spenarnc.xs4all.nl@21:1/5 to sidney.reilley.ii@gmail.com on Wed Jan 1 15:48:15 2025
    In article <20241231192509.3f7fa2025df5fcfc08c50feb@gmail.com>,
    Sidney Reilley <sidney.reilley.ii@gmail.com> wrote:
    On Wed, 1 Jan 2025 13:10:02 +1100
    dxf <dxforth@gmail.com> wrote:

    On 1/01/2025 12:52 pm, Sidney Reilley wrote:
    On Wed, 1 Jan 2025 12:31:46 +1100
    dxf <dxforth@gmail.com> wrote:

    According to the pforth docs it
    has:

    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.

    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.

    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)