which windows am I in?

2019-11-22 Thread ToddAndMargo via perl6-users
Hi All, In Perl6 for Windows, how do I tell if I am in Windows 7 or 10? Many thanks, -T

Re: need windows loop help

2019-11-22 Thread ToddAndMargo via perl6-users
On 2019-11-22 22:33, Raymond Dresens wrote: Hello, What is the function of the 'lines' method call (in @Result.lines.kv) in your for loop? If you remove it, does it 'just do what you want'? That was it. I was remembering when I broke a YUGE string full of line feed into individual

Re: need windows loop help

2019-11-22 Thread Raymond Dresens
Hello, What is the function of the 'lines' method call (in @Result.lines.kv) in your for loop? If you remove it, does it 'just do what you want'? I ask this because of the following interaction on the REPL: > my @x = (1, 2, 3, 4, 5, 6, 7, 8); [1 2 3 4 5 6 7 8] > @x.kv (0 1 1 2 2 3 3 4 4 5 5 6

Re: need windows loop help

2019-11-22 Thread ToddAndMargo via perl6-users
On 2019-11-22 21:52, ToddAndMargo via perl6-users wrote: Hi All, C:\NtUtil>C:\rakudo\bin\perl6.bat -v This is Rakudo Star version 2019.03.1 built on MoarVM version 2019.03 implementing Perl 6.d. Windows 7 SP1, x64 I am trying to write a simple loop in Windows and I am doing something wrong.

for by 3?

2019-11-22 Thread ToddAndMargo via perl6-users
Hi All, In a "for" loop, what is the syntax for "by 3"? for @x.lines by 3 In other words, every third line. Many thanks, -T

need windows loop help

2019-11-22 Thread ToddAndMargo via perl6-users
Hi All, C:\NtUtil>C:\rakudo\bin\perl6.bat -v This is Rakudo Star version 2019.03.1 built on MoarVM version 2019.03 implementing Perl 6.d. Windows 7 SP1, x64 I am trying to write a simple loop in Windows and I am doing something wrong. @Result definitely have something in it. This what the

Re: split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
hello, > You could also use the feed operator is there a reason to do so? i see none. regards marc

Re: split to walk into an HoH ?

2019-11-22 Thread Brian Duggan
On Friday, November 22, Marc Chantreux wrote: > so it becames: > > fix () perl6 -e ' > lines.map( *.split(",") ) > .classify( { .[0] }, :as{ .[1] } ) > .map: { say .key; say "\t$_" for .value.unique } > ' You could also use the feed operator perl6 -e ' lines() ==>

Re: split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
hello, > Hi Marc, I tried the first solution you posted and the "subheaders" > are returned out of order (e.g. "2,1,3" and not "1,2,3"): you're right but it doesn't matter in this usecase. > mbook:~ homedir$ cat p6_chunk_csv.p6 > lines.classify(*.split(",").head(2)).pairs.map: { >

Re: split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
hello, > FWIW, I would make %section an HoA, which would be a less compact > structure in memory, but allows more succinct manipulation, like so: > my %section = lines() > .map( *.split(",") ) > .classify( { .[0] }, :as{ .[1] } ); > for %section.sort { > say .key;

Re: split to walk into an HoH ?

2019-11-22 Thread William Michels via perl6-users
> which led me to this solution: > fix () perl6 -e ' > lines.classify(*.split(",").head(2)).pairs.map: { > .say for .key, |.value.map({ "\t" ~ .key }); > } > ' Hi Marc, I tried the first solution you posted and the "subheaders" are returned out of order (e.g.

Re: split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
hello Timo, > lines()>>.trim-leading.classify(*.split(",").head(2)); say to-json %foo' which led me to this solution: fix () perl6 -e ' lines.classify(*.split(",").head(2)).pairs.map: { .say for .key, |.value.map({ "\t" ~ .key }); } ' fix () perl6 -e '

Re: split to walk into an HoH ?

2019-11-22 Thread William Michels via perl6-users
inline: On Fri, Nov 22, 2019 at 7:20 AM Bruce Gray wrote: > > > > > On Nov 22, 2019, at 9:06 AM, Marc Chantreux wrote: > > > > hello, > > > > On Fri, Nov 22, 2019 at 03:07:28PM +0100, Patrick Spek via perl6-users > > wrote: > >> Could you post some input and expected output? That would make it

Re: split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
hello Bruce, > The first key of each second level is missing, which differs from your sample > output above. > Have I corrupted your Awk code, or have I misunderstood something, or what? you just spotted a bug: the first subkey *is* indeed required. actually fixing the bug makes the awk version

Re: split to walk into an HoH ?

2019-11-22 Thread Bruce Gray
> On Nov 22, 2019, at 9:57 AM, Marc Chantreux wrote: > > On Fri, Nov 22, 2019 at 06:20:51AM -0800, William Michels via perl6-users > wrote: >> Hi Marc, I did a search for 'semicolon' on the following page and >> found the interesting text below. Semicolons are used to create >>

Re: Fwd: split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
On Fri, Nov 22, 2019 at 06:20:51AM -0800, William Michels via perl6-users wrote: > Hi Marc, I did a search for 'semicolon' on the following page and > found the interesting text below. Semicolons are used to create > multidimensional lists, maybe that's what's going on in your code? indeed! i

Re: split to walk into an HoH ?

2019-11-22 Thread Timo Paulssen
Hi Marc, here's a one-liner based on the classify method, which you may find to be an interesting jumping-off-point, or centerpiece: perl6 -e 'use JSON::Fast; my %foo = lines()>>.trim-leading.classify(*.split(",").head(2)); say to-json %foo'     A,1,garbage .     A,2,garbage .    

Re: split to walk into an HoH ?

2019-11-22 Thread Bruce Gray
> On Nov 22, 2019, at 9:06 AM, Marc Chantreux wrote: > > hello, > > On Fri, Nov 22, 2019 at 03:07:28PM +0100, Patrick Spek via perl6-users wrote: >> Could you post some input and expected output? That would make it >> easier for me (and perhaps others) to see what exactly you're trying to >>

Re: split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
> From a quick look through ``Perl6/Grammar.nqp`` and > ``Perl6/Actions.nqp``, I think that the semicolon is special-cased by > the compiler, so the slightly ugly way above (call the operator > directly) is probably the only way that works. *this* is the level of expertise i miss :) thanks for

Re: split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
hello, On Fri, Nov 22, 2019 at 03:07:28PM +0100, Patrick Spek via perl6-users wrote: > Could you post some input and expected output? That would make it > easier for me (and perhaps others) to see what exactly you're trying to > accomplish, in practical terms. sorry ... i'm so confortable with

Fwd: split to walk into an HoH ?

2019-11-22 Thread William Michels via perl6-users
Hi Marc, I did a search for 'semicolon' on the following page and found the interesting text below. Semicolons are used to create multidimensional lists, maybe that's what's going on in your code? https://docs.perl6.org/language/list "Lists of Lists can also be created by combining comma and

Re: split to walk into an HoH ?

2019-11-22 Thread Gianni Ceccarelli
On 2019-11-22 Marc Chantreux wrote: > ";" to walk in the hoh is really awesome but i don't know even know > from where i know it and what's the object underneath. > it isn't listed in the list of operators It's mentioned in the page about subscripts:

Re: split to walk into an HoH ?

2019-11-22 Thread Patrick Spek via perl6-users
Could you post some input and expected output? That would make it easier for me (and perhaps others) to see what exactly you're trying to accomplish, in practical terms. On Fri, 22 Nov 2019 14:39:33 +0100 Marc Chantreux wrote: > hello people, > > removing shell scripts is a good way to learn

split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
hello people, removing shell scripts is a good way to learn raku and compare. today i want to replace this: fix () { awk -F, '{print $1" "$2}' | sort -u | awk -F" " '{ if (seen == $1) print "\t"$2; else { seen = $1;