最も単純です。
StandardEncoding ==
またはインデックス付き。10 進数:
0 StandardEncoding { exch dup =only(: )print 1 add exch == } forall pop
8 進数:
0 StandardEncoding { exch dup 8 3 string cvrs =only(: )print 1 add exch == } forall pop
16 進数:
0 StandardEncoding { exch dup 16 2 string cvrs =only(: )print 1 add exch == } forall pop
/StandardEncoding
また、それはリテラル名であることを知っておく必要があります( のため/
)。そのため、名前自体がスタックに置かれます。次のステップに進んで文字列に変換した場合、単に「StandardEncoding」という単語が出力されます。したがって、名前に関連付けられた値を自動的にロード (および場合によっては実行) するには、スラッシュ ( /
) を削除して、名前がexecutableになるようにします。単語StandardEncoding
(スラッシュなし!) がベクトルになります。quote
スラッシュは、Lisp ファミリーの言語とほとんど同じように機能します。
説明のために、印刷と配列の繰り返しの両方の方法をいくつか示します。
StandardEncoding {
(%stdout)(w)file exch 80 string cvs writestring
(%stdout)(w)file (\n) writestring
} forall
StandardEncoding
0 1 2 index length 1 sub { % Arr i
2 copy get 80 string cvs print % Arr i
(\n) print % Arr i
pop % Arr
} for
[ StandardEncoding 0 {
{
2 copy get ==only
()=
1 add
} loop
} stopped cleartomark
この最後のものは無限ループを使用し、存在しない要素を読み取ろうとしたrangecheck
ときに通知されるエラーをトラップします。get
スタック ( ) に 5 つの値が残りますが、示されているように、または単純に(または)StandardEncoding 256 StandardEncoding 256 true
破棄できます。cleartomark
pop pop pop pop pop
5{pop}repeat
編集:最後の例でさらに遊んでください。これにより、エラーをスローすると予想されるオペレーターにエラー トラップが分離されます。予期されるエラーを分離することで、予期しないエラーが通常の診断を出力できるようになります。
[ StandardEncoding 0 {
2 copy
{ get } stopped { exit } if
==only ()=
1 add
} loop cleartomark