On Fri, Nov 21, 2008 at 12:20 AM, Jonathan Kelly <[EMAIL PROTECTED]> wrote:
> Hi List,
>
> a couple of things related to my first steps into factor ...
>
> ---------
> USING: kernel io io.encodings.utf8 io.files ;
> IN: t1
> : t1a ( -- ) "c:/factor/work/t1/test.txt" utf8 <file-reader> [ dup
> stream-readln dup ] [ print ] [ drop drop ] while ;
> --------

'while' is a bit tricky. Try this,

: t1a ( -- )
    "c:/factor/work/t1/test.txt" utf8 <file-reader>
    [ dup stream-readln dup ] [ print ] [ drop ] while drop ;

It compiles without errors.

An easier way to do the above,

: t1a ( -- )
    "c:/factor/work/t1/test.txt" utf8 file-lines [ print ] each ;

Slava

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to