[julia-users] Re: readchomp, readlines & friends on Windows

2014-03-11 Thread Ivar Nesje
Usually you should be using eachline instead of readlines, especially for large files, because they return an iterator and does not allocate strings for the individual lines, so that garbage collection can free the intermediary strings. kl. 04:19:25 UTC+1 tirsdag 11. mars 2014 skrev Peter Simon

[julia-users] Re: readchomp, readlines & friends on Windows

2014-03-10 Thread Peter Simon
Thank-you to Tony for straightening me out (off-line). As clearly stated in the help, readchomp() is *supposed* to return a single string, and only strips newlines from the very end. What I wanted was lines = open("test.txt","r") do fid map(chomp,readlines(fid)) end which works fine. S

[julia-users] Re: readchomp, readlines & friends on Windows

2014-03-10 Thread Tony Kelman
+1 for more "doing-the-right-thing"-ness wrt annoying carriage returns. Semi-related: in test/spawn.jl, the tests on lines 17 and 23 fail when run in a Windows command prompt but succeed from an MSYS/Cygwin terminal because they pipe to whichever sort.exe is found in PATH, and lines are termina