以下は、 標準の Forth ワード群を使用して新しいワードリストを作成および使用する例です:
wordlist constant my-new-words-wordlist : my-new-words get-order nip my-new-words-wordlist swap set-order ; \ add it to the search order also my-new-words \ alternatively, add it to the search order and make it \ the compilation word list also my-new-words definitions \ type "order" to see the problem
この例での問題は、 order
には my-new-words
という名前をワードリスト の wid
に関連付ける方法がないことです(Gforth では、 order
と vocs
において、 名前が関連付けられていない
wid では wid そのものが表示されます)。 名前を wid に関連付ける標準の方法はありません。
Gforth では、 この例は、 以下のように、 名前を wid に関連付ける vocabulary
を使用して再コーディングできます:
vocabulary my-new-words \ add it to the search order also my-new-words \ alternatively, add it to the search order and make it \ the compilation word list my-new-words definitions \ type "order" to see that the problem is solved