Oh, the single underline was used in 'fry' vocab.
I consider using a double underline to represent anonymous variables...
--
KUSUMOTO Norio
> 2019/09/19 7:21、KUSUMOTO Norio のメール:
>
>> Yep, you can also use the syntax for it:
>>
>> << { "foo "bar" "baz" } [ create-word-in define-symbol ]
> 2019/09/19 11:21、John Benediktsson のメール:
>
> Some small simplifications using ``counter`` and ``slots>tuple``:
These are nice!
Thanks, Jhon. I'll use them.
My code was heavy and confused about what was "anonymous variable".
So I change it as follow:
SYMBOL: *anonymouse-var-no*
:
Some small simplifications using ``counter`` and ``slots>tuple``:
```
SYMBOL: *anonymouse-var-no* 0 *anonymouse-var-no* set-global
: reset-anonymouse-var-no ( -- ) 0 *anonymouse-var-no* set-global ;
: generate-anonymouse-var ( -- var-symbol )
[
*anonymouse-var-no* counter
> Yep, you can also use the syntax for it:
>
> << { "foo "bar" "baz" } [ create-word-in define-symbol ] each >>
Thank you.
My program needs to make a symbol every time it finds '_'.
It became as follows:
SYMBOL: *anonymouse-var-no* 0 *anonymouse-var-no* set-global
: reset-anonymouse-var-no
Yep, you can also use the syntax for it:
<< { "foo "bar" "baz" } [ create-word-in define-symbol ] each >>
On Tue, Sep 17, 2019 at 7:13 AM KUSUMOTO Norio
wrote:
> > How do I code to generate symbols at runtime? "define-symbol" seems to
> work
> > only at compile time.
>
> Oh, I was able to do
> How do I code to generate symbols at runtime? "define-symbol" seems to work
> only at compile time.
Oh, I was able to do it as follows:
[ "a-symbol" "factor-logica" create-word define-symbol ] with-compilation-unit
--
KUSUMOTO Norio
> 2019/09/17 19:40、KUSUMOTO Norio のメール:
>
> Hello
Hello all,
How do I code to generate symbols at runtime? "define-symbol" seems to work
only at compile time.
I'm writing an embedded language that runs on Factor with the capabilities of
a subset of Prolog. To achieve the anonymous variable functionality, I want to
generate as many symbols as