> 2019/09/19 11:21、John Benediktsson <[email protected]>のメール:
>
> 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*
: reset-anonymouse-var-no ( -- ) 0 *anonymouse-var-no* set-global ;
: var-for-'_' ( -- var-symbol )
[
*anonymouse-var-no* counter "ANONYMOUSE-VAR%d_" sprintf
"factor-logica" create-word dup dup
define-symbol
LOGIC-VAR swap set-global
] with-compilation-unit ;
: replace-'_' ( before -- after )
{
{ [ dup _ = ] [ drop var-for-'_' ] }
{ [ dup sequence? ] [ [ replace-'_' ] map ] }
{ [ dup tuple? ] [
[ tuple-slots [ replace-'_' ] map ]
[ class-of slots>tuple ] bi ] }
[ ]
} cond ;
--
KUSUMOTO Norio
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk