Re: must chomp input files (was Re: processing a file in chunks)

2019-10-20 Thread William Michels via perl6-users
I can confirm what Yary is seeing with respect to the "lines(:!chomp)" call. Below I can print things out on a single line (using "print"), but the use of "print" or "put" appears to be controlling, not manipulating the "chomp" option of "lines()". > mbook:~ homedir$ cat abc_test.txt line aardvark

must chomp input files (was Re: processing a file in chunks)

2019-10-20 Thread yary
It seems that *ARGFILES is opened with :chomp=True, so adding :!chomp to the lines call is too late. $ perl6 -e "say 11; say 22; say 33;" | perl6 -e '.say for lines(:chomp)' *11* *22* *33* $ perl6 -e "say 11; say 22; say 33;" | perl6 -e '.say for lines(:!chomp)' *11* *22* *33* -y

Re: processing a file in chunks

2019-10-20 Thread Joseph Brenner
Thanks, that looks good. At the moment I was thinking about cases where there's no need division by lines or words (like say, hypothetically bioinformatics data: very long strings no line breaks). On 10/20/19, Elizabeth Mattijsen wrote: >> On 20 Oct 2019, at 23:38, Joseph Brenner wrote: >> I wa

Re: processing a file in chunks

2019-10-20 Thread Joseph Brenner
Yes, you can call .comb on a file handle (which I hadn't realized) and if you give it an integer as first argument, that treats it as a chunk size... So stuff like this seems to work fine: my $fh = $file.IO.open; my $chunk_size = 1000; for $fh.comb( $chunk_size ) -> $chunk { sa

Re: processing a file in chunks

2019-10-20 Thread Elizabeth Mattijsen
> On 20 Oct 2019, at 23:38, Joseph Brenner wrote: > I was just thinking about the case of processing a large file in > chunks of an arbitrary size (where "lines" or "words" don't really > work). I can think of a few approaches that would seem kind-of > rakuish, but don't seem to be built-in anyw

Re: processing a file in chunks

2019-10-20 Thread Joseph Brenner
Thanks, I'll take a look at that. Brad Gilbert wrote: > Assuming it is a text file, it would be `.comb(512)` > > On Sun, Oct 20, 2019 at 4:39 PM Joseph Brenner wrote: > >> I was just thinking about the case of processing a large file in >> chunks of an arbitrary size (where "lines" or "words" do

Re: processing a file in chunks

2019-10-20 Thread Brad Gilbert
Assuming it is a text file, it would be `.comb(512)` On Sun, Oct 20, 2019 at 4:39 PM Joseph Brenner wrote: > I was just thinking about the case of processing a large file in > chunks of an arbitrary size (where "lines" or "words" don't really > work). I can think of a few approaches that would

processing a file in chunks

2019-10-20 Thread Joseph Brenner
I was just thinking about the case of processing a large file in chunks of an arbitrary size (where "lines" or "words" don't really work). I can think of a few approaches that would seem kind-of rakuish, but don't seem to be built-in anywhere... something like a variant of "slurp" with an argumen

Re: order of execution

2019-10-20 Thread yary
Seems like we can answer "Is it also true when compiling?" by putting the REPL code into a file! $ cat order-execution.raku class Y { method y (Int $y) {note $y}} my Y $y .= new; sub b (Int $i --> Int) { note "about to increment i above $i"; $i + 10 } say b(10); say $y.?y(b(11)); say $y.?unde

order of execution

2019-10-20 Thread Marcel Timmerman
Hello all, I've a small question where I want to know what is processed first in the following line $my-object.?"my-method"(some-complex-argument-calculation()) Will the sub 'some-complex-argument-calculation()' always be run even when 'my-method' is not available because the sub must be e