(syntaxic choices) Re: split to walk into an HoH ?

2019-11-25 Thread Marc Chantreux
> I don't think so; just a stylistic choice well ... i tested ===> once because i'll choose any syntax that can spare me parenthesis especially in raku because i feel they are in the wrong place (scheme makes parenthesis right). Raku behaves better than perl in this regard because say (f 12)

Re: split to walk into an HoH ?

2019-11-25 Thread Brian Duggan
On Friday, November 22, Marc Chantreux wrote: > hello, > > > You could also use the feed operator > > is there a reason to do so? i see none. I don't think so; just a stylistic choice -- though the documentation lists some potential benefits at the end of the section here https://docs.raku.o

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() ==> map({split(","

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. "2

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 >> multidimension

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 trie

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 .     A,2,gar

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 you

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 aw

Fwd: split to walk into an HoH ?

2019-11-22 Thread William Michels via perl6-users
1) print "\t"$2; > else { seen = $1; print $1 } > }' > } > > and i got this: > > fix () perl6 -e ' > my %section; > lines.map: { > my ($s,$ss) = .split(","); > %section{$s;$ss} =

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: htt

Re: split to walk into an HoH ?

2019-11-22 Thread Patrick Spek via perl6-users
; > else { seen = $1; print $1 } > }' > } > > and i got this: > > fix () perl6 -e ' > my %section; > lines.map: { > my ($s,$ss) = .split(","); > %section{$s;$ss} = 1; >

split to walk into an HoH ?

2019-11-22 Thread Marc Chantreux
quot;\t"$2; else { seen = $1; print $1 } }' } and i got this: fix () perl6 -e ' my %section; lines.map: { my ($s,$ss) = .split(","); %section{$s;$ss} = 1; } %section.keys.map: { .say

[perl #68252] [BUG] .WALK(:name, :descentant) is broken in Rakudo

2009-08-06 Thread Carl Mäsak
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #68252] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=68252 > rakudo: 1.WALK(:name,:descendant) rakudo 6ba717: OUTPUT«Parameter type

.WALK

2009-05-07 Thread Jonathan Worthington
Hi, I've just checked in a test file for .WALK as spec'd in S12. http://svn.pugscode.org/pugs/t/spec/S12-introspection/walk.t While I'm happy :canonical, and :super are correct (the first is just C3 by default and the second just those from the superclass) and I think :breadth

[perl #46683] [TODO] [C] Walk the fixups, locate globals and nullify the Sub PMC

2007-10-22 Thread via RT
ill exist, calling them will segfault * as the segment is destroyed now. * * TODO walk the fixups for this segment, locate globals * and nullify the Sub PMC. * This probably needs a pointer into the globals. * * OTOH - if the global exi

[perl #46665] [TODO] [C] Walk the Method Resolution Order (MRO) in src/pmc/defaults.pmc

2007-10-22 Thread via RT
XME - walk mro */ I think this means that instead of directly returning (which is what these methods currently do) one should do some form of method resolution and determine which method should actually be called in this instance.

[perl #46171] [TODO] Parrot_find_name_op() should walk up the scopes

2007-10-06 Thread via RT
KEN - it doesn't walk up the scopes yet - TODO

Re: clarify: how WALK arguments can be combined

2006-09-05 Thread Mark Stosberg
Brad Bowman wrote: > Mark Stosberg wrote: >> In the Objects chapter, a WALK pseudo-class is spec'ed for using >> when calling sets of methods: >> >> http://feather.perl6.nl/syn/S12.html#Calling_sets_of_methods >> >> These are the arguments listed that

Re: clarify: how WALK arguments can be combined

2006-09-04 Thread Brad Bowman
Mark Stosberg wrote: In the Objects chapter, a WALK pseudo-class is spec'ed for using when calling sets of methods: http://feather.perl6.nl/syn/S12.html#Calling_sets_of_methods These are the arguments listed that can be used with WALK: :canonical # canonical dispatch

clarify: how WALK arguments can be combined

2006-09-04 Thread Mark Stosberg
In the Objects chapter, a WALK pseudo-class is spec'ed for using when calling sets of methods: http://feather.perl6.nl/syn/S12.html#Calling_sets_of_methods These are the arguments listed that can be used with WALK: :canonical # canonical dispatch order :ascendant #

Re: Stack Walk Speedups?

2002-08-17 Thread Peter Gibbs
(and hence PARROT_PTR_ALIGNMENT = 1), but IIRC a push or pop will always change the SP by 2 or 4, therefore the stack walk code can do the same. In a quick test, using a hardcoded value of 2 in the stack walk code, 5000 lives dropped down to 112 seconds. -- Peter Gibbs EmKel Systems

Re: Stack Walk Speedups?

2002-08-17 Thread Jason Gloudon
On Sat, Aug 17, 2002 at 10:23:32PM +0200, Peter Gibbs wrote: > If you want to get some improvement at the cost of some duplicated > code, you can remove the * direction logic, and write two copies of the > loop. (patch attached, but not fully tested) > I'm sure there is more that can be done, b

Re: Stack Walk Speedups?

2002-08-17 Thread Peter Gibbs
Mike Lambert wrote: > As Peter has pointed out, our stackwalk code is rather slow. > Anyone feeling adventuresome and want to attempt to speed this up? If you want to get some improvement at the cost of some duplicated code, you can remove the * direction logic, and write two copies of the loo

Stack Walk Speedups?

2002-08-17 Thread Mike Lambert
that pool. Currently, this is a linear walk over the header pools. I imagine there are many better algorithms for determing a root set from a stack. The boehm collector probably has decent code in this regard. However, given that we have O(N) with size of stack, I'm not sure how we'll