forthgforthwin32forth

What is RDROP in Forth?


I'm new to Forth and I'm using SwiftForth. I am looking for a way to read a matrix from file as described here Writing a text file into an array on Forth, but rdrop is not recognised. Is this exclusive to Gforth or is it part of a library? If it's a library, what are the steps needed to use it?


Solution

  • RDROP is a well known but not standardized word.

    This word can be defined in the following way:

    : rdrop ( R: x -- ) postpone r> postpone drop ; immediate
    
    

    A conditional definition in a portable library can look like the following:

    [UNDEFINED] RDROP [IF]
    : RDROP ( R: x -- ) POSTPONE R> POSTPONE DROP ; IMMEDIATE
    [THEN]