It was a design decision to not allow readln for binary, because it doesn't make sense. On streams with a string encoding, line breaks are interpreted to be \n, \r or \r\n. If the text isn't meant to be understood as a string of text, I don't know what a line break would be. An octet that's \n or \r isn't universally a line break, for example in UTF-16BE, the possible ways to break lines are \0\n, \0\r and \0\r\0\n. If your input is something that's base64-encoded, for example, then it should be treated as ascii, but if it's arbitrary binary stuff, ascii shouldn't be used. What are you trying to do here?
Dan On Thu, Jan 15, 2009 at 1:34 PM, Adam <[email protected]> wrote: > Hmmm, I was working with: > > > "/path/to/bigfile" ascii [ [ ... ] each-line ] with-file-reader > > But I want to work with a binary data... is ascii 'safe' enough for > that? Binary encoding doesn't work with readln. > > On Thu, Jan 15, 2009 at 11:14 AM, Samuel Tardieu <[email protected]> wrote: >>>>>>> "Adam" == Adam <[email protected]> writes: >> >> Adam> Is there a feature in Factor that acts like Generators in >> Adam> Python? I.E. adding an iteration protocol where a result is >> Adam> computed, returned, and then yeilds to the caller? >> >> You can also use lazy lists (in "lists.lazy"). For an example, you can >> look at "math.primes.lists", where "lprimes" is an infinite stream >> containing all the prime numbers: >> >> USE: math.primes.lists >> 100000 lprimes lnth >> ===> 1299721 >> >> "lprimes" is defined as its first element and a word to get from the >> current element to the next one: >> >> : lprimes ( -- list ) 2 [ next-prime ] lfrom-by ; >> >> Sam >> -- >> Samuel Tardieu -- [email protected] -- http://www.rfc1149.net/ >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> _______________________________________________ >> Factor-talk mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/factor-talk >> > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Factor-talk mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/factor-talk > ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
