Possible zef addition
So I'm playing around with Docker files (Perl 5 ATM) and one thing I'm getting quite into is trying to keep them small. An important part of this is deleting any extraneous caching info built up during the build, preferably as part of the RUN step to get intermediate layers small. (So with Perl5 and cpanm `rm -rf ~/.cpanm` is your friend). Anyhoo, my thought was could we add something to zef to do this? Either a flag or a new command to auto clean up the ~./zef folder. Yes I know rm -rf ~/.zef is simple to type but if it was built into the command it would show forward thinking. Or something. It's 5am and I couldn't sleep. This is the kind of idea I get. Simon
Re: How to pin down a bug in Rakudo?
Have you considered the effects of lazy evaluation for the hash's values method? .sort will eagerly evaluate the whole .values list (i.e. snapshot it) while iterating over it will include added keys and such.
How to pin down a bug in Rakudo?
This is to ask advice on how to pin down what appears to be a subtle bug in Rakudo so that I can file a bug report. *Background* I am updating the work I have down on ModuleCitation, which is not efficient at present. Since I am create a recursive index, that is modules which cite modules, etc, there is a chance for a cycle and hence a recursive hole. I avoid this by calling another module I wrote called Algorithm::Tarjan. When passing the new software through a series of unit tests, I get an error in the Tarjan module. I isolated the lines of code and included the whole of the Tarjan algorithm in a test program, and got the error to recur. It was occurring in a block that started for %!nodes.values -> $module { # each value is an object with an attribute 'name' } When trying to work out whether the problem was in the data, I amended the line to for %!nodes.values.sort( { .name } ) -> $module { # the idea is to print trace statements that can be easily identfied but then the whole of the new module worked without error. The order of the objects should not have any effect on the algorithm. So then I wondered if this was a bug that had been picked up already, so I updated my perl6 to the most recent version of Rakudo. Now the program with the isolated code and the data samples that I prepared works without error and without the .sort kludge. However, the unit tests of the ModuleCitation module still fail without the kludge, but succeed if the kludge in the Tarjan module. *Conclusion* The problem does not appear to be a programming error because a change that should have no effect on the algorithm cures the error. The problem seems to be a bug in Rakudo. The problem seems to be related to the size of a data structure and the complexity of the software. *Advice requested* In order to be more useful to Rakudo developers, I would like to try to find a way to reproduce the error without the specific application I am developing. (I would also like to eliminate the possibility that it is a programming error of mine). If there is a need to find a work around and include it the existing Tarjan algorithm, I would prefer it wasn't something like a sort. Since I don't know what the standard .sort method does, I am not sure how to create a sample set of data to reproduce the error. Any ideas about what to try? I have been abstract here to get some general ideas about what to try. If anyone would like to look at the source files, I can mail them. However, I think that there may be a problem that is connected to speed or memory limitations. Regards, Richard
Re: Module distribution
Hi Richard, I think you need to do the following: - zef --depsonly install . Instead of - zef installdeps . Already discussed that concern in https://github.com/ugexe/zef/issues/82 :) On Wed, May 24, 2017 at 2:41 PM, Richard Hainsworthwrote: > The Ecosystem (that is the modules.perl6.org web page) shows whether a > module is passing its tests. > > The system takes the error passing information from the Travis system. > > The Ecosystem documentation (on distributing a module) does not give any > template for Travis. It would be useful for someone to put up a template. > > I used an existing module to work out the contents of a 'travis.yml' file > for my module. But now that Panda is no longer supported, the Travis > system is failing, and I don't really understand why. After all, if Panda > was working before and has not been broken, then why is it failing now. > > I tried to change references to panda with references to zef, > > eg > > install: > > - rakudobrew zef > > - zef installdeps . > > > But this is now failing at "zef installdeps ." > > > Some help from Travis / github gurus would be appreciated. > > Regards, > > Richard >
Module distribution
The Ecosystem (that is the modules.perl6.org web page) shows whether a module is passing its tests. The system takes the error passing information from the Travis system. The Ecosystem documentation (on distributing a module) does not give any template for Travis. It would be useful for someone to put up a template. I used an existing module to work out the contents of a 'travis.yml' file for my module. But now that Panda is no longer supported, the Travis system is failing, and I don't really understand why. After all, if Panda was working before and has not been broken, then why is it failing now. I tried to change references to panda with references to zef, eg install: - rakudobrew zef - zef installdeps . But this is now failing at "zef installdeps ." Some help from Travis / github gurus would be appreciated. Regards, Richard
Re: Task::Star and Panda
I removed the recommendation to install Task::Star yesterday, so as of writing of your email it shouldn't have been on rakudo's website at least. did you find a reference to Task::Star somewhere else?
Re: need help with "next"
On 05/24/2017 01:04 AM, Richard Hainsworth wrote: see https://docs.perl6.org/language/regexes#Subrules Fascinating and way over my head. Give me a year or two to catch up.
Re: need help with "next"
On 05/24/2017 01:04 AM, Richard Hainsworth wrote: On 05/23/2017 10:31 PM, Richard Hainsworth wrote: > The code below seems unnecessarily complex. > > How about: > > my @Data = q:to/SAMPLE/; > > Mission D', > Sol Wheat, > Ted Moon, > ; > > SAMPLE > > for @Data { > next unless m/ 'NAME' .*? '>' $=( .*? ) '<' /; > say $; # say implicitly stringifies $ > } > > > Hi Richard. The idea is that the names can not be extracted unless they are embedded inside a task field. I found the `next` did not differentiate that. If I only wanted to extract the names, regardless of what field they were in, that would be a lot easier! -T Tod, The original question was about the logic of using 'next'. A 'next' statement does not itself differentiate data. Then you suggested some code, which doesn't really feel as if you are using the power of perl6. If you want to separate out chunks of data separated by tags, and then operate on data within that, then I suggest you look at using rules to parse the data. If you look at the documentation on regexen, see https://docs.perl6.org/language/regexes#Subrules , you will find a way of parsing .ini files. This seems close to what you are wanting. Richard I was just playing around. The more of these little programs I write, the more comfortable I get with Perl 6
Re: need help with "next"
On 05/23/2017 10:31 PM, Richard Hainsworth wrote: > The code below seems unnecessarily complex. > > How about: > > my @Data = q:to/SAMPLE/; > > Mission D', > Sol Wheat, > Ted Moon, > ; > > SAMPLE > > for @Data { > next unless m/ 'NAME' .*? '>' $=( .*? ) '<' /; > say $; # say implicitly stringifies $ > } > > > Hi Richard. The idea is that the names can not be extracted unless they are embedded inside a task field. I found the `next` did not differentiate that. If I only wanted to extract the names, regardless of what field they were in, that would be a lot easier! -T Tod, The original question was about the logic of using 'next'. A 'next' statement does not itself differentiate data. Then you suggested some code, which doesn't really feel as if you are using the power of perl6. If you want to separate out chunks of data separated by tags, and then operate on data within that, then I suggest you look at using rules to parse the data. If you look at the documentation on regexen, see https://docs.perl6.org/language/regexes#Subrules , you will find a way of parsing .ini files. This seems close to what you are wanting. Richard
Re: need help with "next"
On 05/24/2017 12:02 AM, Norman Gaywood wrote: On 24 May 2017 at 16:40, Norman Gaywood> wrote: However, your code does not look like it will do what you want if you have multiple TASKs Yes it does. Sorry ignore me :-) Oh it had issues. They showed up when I mixed in negative case data.
Re: need help with "next"
On 05/23/2017 11:40 PM, Norman Gaywood wrote: I'm a rank beginner p6 programmer so You are further along than me!
Re: need help with "next"
On 05/23/2017 11:40 PM, Norman Gaywood wrote: However, your code does not look like it will do what you want if you have multiple TASKs I improved it. See my other follow post #3
Re: need help with "next"
Oh, you know what, I thought it might be a good idea to throw some negative case data into the mix. This is what I came up with: #!/usr/bin/env perl6 use strict; my @Data = 'Mission A', ' Peter Meter', ' John Deer', ' Sam Horse', '', '', 'Mission A', ' Tom', ' Dick', ' Harry', '', '', 'Mission D', ' Sol Wheat', ' Micky Mouse', ' Ted Moon', ''; # for @Data -> $Line { say "$Line"; } my $TaskTag = 0; for @Data -> $Line { if $Line.contains( "\//; $Name ~~ s/\<.*//; say $Name; } } $ ./XMLSub.pl6 Peter Meter John Deer Sam Horse Sol Wheat Ted Moon -- ~ I am Windows I am the Blue Screen of Death No one hears your screams ~
Re: need help with "next"
On 24 May 2017 at 16:40, Norman Gaywoodwrote: > > However, your code does not look like it will do what you want if you have >> multiple TASKs >> > > Yes it does. Sorry ignore me :-) -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au http://turing.une.edu.au/~ngaywood Phone: +61 (0)2 6773 2412 Mobile: +61 (0)4 7862 0062 Please avoid sending me Word or Power Point attachments. See http://www.gnu.org/philosophy/no-word-attachments.html
Re: need help with "next"
On 24 May 2017 at 15:20, ToddAndMargowrote: > > > This is what I came up with. I found that `next` did not serve me > well, so i just used a tag. > > Thank you all for the help. I had a bit of a time wrapping > my head around `next` there for a while. > > -T > > > #!/usr/bin/env perl6 > > use strict; > > my @Data = 'Mission D', >' Sol Wheat', >' Ted Moon', >''; > # for @Data -> $Line { say "$Line"; } > > my $TaskTag = 0; > for @Data -> $Line { >if $Line.contains( "TASK type" ) { $TaskTag = 1; } > >if $Line.contains( "NAME type" ) { > ( my $Name = $Line) ~~ s/.*?\>//; > $Name ~~ s/\<.*//; > say $Name; >} else { $TaskTag = 0; } > > } > > I'm a rank beginner p6 programmer so I'm sure my code can be improved. However, your code does not look like it will do what you want if you have multiple TASKs What about something like: my @Data = 'Mission D', ' Sol Wheat', ' Ted Moon', '', 'Mission C', ' Jim Kirk', ' Mr Spock', '', ; my $in-TASK = ""; for @Data -> $Line { if $Line.contains( "TASK type" ) { $Line ~~ m/ 'TASK' .*? '>' $=( .* ) /; $in-TASK = $; next; } if $Line.contains( "/TASK" ) { $in-TASK = ""; next; } if $in-TASK ne "" && $Line.contains( "NAME type" ) { $Line ~~ m/ 'NAME' .*? '>' $=( .*? ) '<' /; say $in-TASK, $; } } -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au http://turing.une.edu.au/~ngaywood Phone: +61 (0)2 6773 2412 Mobile: +61 (0)4 7862 0062 Please avoid sending me Word or Power Point attachments. See http://www.gnu.org/philosophy/no-word-attachments.html
Re: need help with "next"
On Wednesday, May 24, 2017 01:20 PM, ToddAndMargo wrote: On 05/23/2017 09:30 PM, ToddAndMargo wrote: Hi All, I have a test code in progress and I haven't figured out how to get 'next' to work the way I want. next if $Line.contains( "TASK type" ); works, but if $Line.contains( "TASK type" ) { next; does not. What am I missing? Many thanks, -T yes I know I still have some things to fix on it. #!/usr/bin/env perl6 use strict; my @Data = 'Mission D', ' Sol Wheat', ' Ted Moon', ''; # for @Data -> $Line { say "$Line"; } for @Data -> $Line { # next if $Line.contains( "TASK type" ); if $Line.contains( "TASK type" ) { next; my $Name = $Line; if $Name.contains( "NAME type" ) { $Name ~~ s/.*?\>//; $Name ~~ s/\<.*//; say $Name; } } } Follow up. This is what I came up with. I found that `next` did not serve me well, so i just used a tag. Thank you all for the help. I had a bit of a time wrapping my head around `next` there for a while. -T #!/usr/bin/env perl6 use strict; my @Data = 'Mission D', ' Sol Wheat', ' Ted Moon', ''; # for @Data -> $Line { say "$Line"; } my $TaskTag = 0; for @Data -> $Line { if $Line.contains( "TASK type" ) { $TaskTag = 1; } if $Line.contains( "NAME type" ) { ( my $Name = $Line) ~~ s/.*?\>//; $Name ~~ s/\<.*//; say $Name; } else { $TaskTag = 0; } } On 05/23/2017 10:31 PM, Richard Hainsworth wrote: > The code below seems unnecessarily complex. > > How about: > > my @Data = q:to/SAMPLE/; > > Mission D', > Sol Wheat, > Ted Moon, > ; > > SAMPLE > > for @Data { > next unless m/ 'NAME' .*? '>' $=( .*? ) '<' /; > say $; # say implicitly stringifies $ > } > > > Hi Richard. The idea is that the names can not be extracted unless they are embedded inside a task field. I found the `next` did not differentiate that. If I only wanted to extract the names, regardless of what field they were in, that would be a lot easier! -T -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~