Ha! This is neat trick. Actually, what I needed that for was to call an init-type function only once, and this technique is perfect for that kind of job. No extra symbols.
 
Thanks, John!
 
25.08.2017, 23:28, "John Benediktsson" <mrj...@gmail.com>:
You can get similar behavior if you want a less general approach by doing something like this, using the word symbol as a variable:
 
: foo ( x -- y )
    \ foo [
        [ 1 + ] unless t
    ] change-global ;
 
IN: scratchpad 1 foo .
 
IN: scratchpad 1 foo .
1
 
 
---=====---
Александр
 
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to