If we ignore the fact that that looks like a weird program for someone to
want to replicate in any language... ;)
... then what ?key seems to be is a non-blocking stdin-read function.
I don't know if Factor has non-blocking peek/read, to be honest.
So I guess I'm not of any help beyond naming the thing you want. :)
rien
On Fri, Nov 4, 2011 at 6:14 PM, John Porubek <[email protected]> wrote:
> I'm having fun learning Factor and imagining the cool things I'll be
> able to do with it someday. But for now, most of my coding involves
> translating simple things I've done before in Forth. Sometimes this
> can be frustrating. For example, in Forth I might have the following:
>
> : foo begin ." Hi" ?key until ;
>
> If I execute foo, it will print 'Hi' continuously until I hit a key
> (any key). My roughly analogous attempt in Factor is:
>
> : foo ( -- ) [ 1 read "q" = not ] [ "Hi" print ] while ;
>
> This is problematic for a couple of reasons. For one, I have to enter
> a <cr> to have it print 'Hi'. For another, I have to enter the test
> for a specific character ('q' in this case) to break out of the loop.
> I read about key gestures, but they seem like overkill for what I'm
> looking for. Is there a simple way to get the functionality Forth's
> 'key?' offers in Factor? Or, if I have to use key gestures, what's the
> simplest possible way to use them?
>
> Thanks,
>
> --John
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk