This will work as you expected: USE: locals :: fnc ( -- ) 0 :> i! 3 [ i 1 + i! i . ] times ; fnc
1 2 3 04.02.2019, 09:17, "KUSUMOTO, Norio" <[email protected]>: > Hello to all, > > I’m writing a hierarchical finite state machine library as my first Factor > program. > It seems to me that It works for once now! But, there are some questions in > my mind. > > I could not handle local variables well, so I tried below words in a listener. > > USE: locals > :: fnc ( -- ) 0 :> i 3 [ i 1 + :> i i . ] times ; > fnc > > These words returned: > 1 > 1 > 1 > > Originally, I wanted to know that why the below words didn’t perform as > expected. > > USE: locals > :: fnc2 ( -- ) 0 :> i [ i 3 < ] [ i 1 + :> i i . ] while ; > > It will perform as a infinite loop. > > In these cases, how should I write them? > > -- > KUSUMOTO Norio > > _______________________________________________ > Factor-talk mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/factor-talk ---=====--- Александр _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
