Re: Rewrite using map? Trasformation array into hash of hash

2014-06-13 Thread Elizabeth Mattijsen
On 13 Jun 2014, at 12:36, Kamil Kułaga teodoz...@gmail.com wrote: I was wondering whether following code can be rewritten using map/grep construct. class A { has $.a; has $.b; } my @array= ( A.new(a='a', b='11'), A.new(a='a', b='22'), A.new(a='v',

Re: Diffrence between is and does in scope of overriding multi methods

2014-06-27 Thread Elizabeth Mattijsen
On 27 Jun 2014, at 09:25, Timo Paulssen t...@wakelift.de wrote: On 27/06/14 10:07, Kamil Kułaga wrote: Hi, I would like to ask for help in understanding difference between this code: use v6; role X { multi method xyz(Any $a) {say Class X} } class Y does X {

Re: Compile a program into moar vm

2015-01-02 Thread Elizabeth Mattijsen
On 01 Jan 2015, at 19:36, MAX PUX isleof...@gmail.com wrote: Excuse me but I can't find the documentation. Is there a way to compile a perl 6 program to moar vm bytecode? For example from example.pl to example.moarvm. CompUnit.new(‘example.pl’).precomp will create an ‘example.pl.moarvm’.

Re: What is the latest Rakudo Star?

2015-01-03 Thread Elizabeth Mattijsen
On 03 Jan 2015, at 21:32, Parrot Raiser 1parr...@gmail.com wrote: I stopped paying attention for a bit, and lost track. 2014.12.1 Liz

Re: Debug core modules

2015-01-11 Thread Elizabeth Mattijsen
On 11 Jan 2015, at 10:57, MAX PUX isleof...@gmail.com wrote: is there a way to debug core modules like IO::Socket::INET? Generally, you can copy a module out of the core settings and run from source: the module in source will hide the one from the settings. Is that what you mean? Liz

Re: Object Contruction

2015-03-18 Thread Elizabeth Mattijsen
On 18 Mar 2015, at 23:21, Tom Browder tom.brow...@gmail.com wrote: You are correct, Liz, but I was trying those pieces to demonstrate to myself that all was available to me in the methods and all worked as I expected. It demos very roughly what I think I have to do to translate

Re: Object Introspection for Existence of Methods: How?

2015-03-23 Thread Elizabeth Mattijsen
On 23 Mar 2015, at 14:11, Tom Browder tom.brow...@gmail.com wrote: On Mon, Mar 23, 2015 at 7:04 AM, Tom Browder tom.brow...@gmail.com wrote: From your and Henk's comments, I think I need to learn a lot more about testing in general. Any recommendations for books on the subject? Perl Testing

Re: Object Contruction

2015-03-18 Thread Elizabeth Mattijsen
On 18 Mar 2015, at 21:32, Tom Browder tom.brow...@gmail.com wrote: On Wed, Mar 18, 2015 at 11:32 AM, Tom Browder tom.brow...@gmail.com wrote: On Wed, Mar 18, 2015 at 7:22 AM, Moritz Lenz mor...@faui2k3.org wrote: ... http://doc.perl6.org/language/objects#Object_Construction lists at least two

Re: Books on Perl 6

2015-04-19 Thread Elizabeth Mattijsen
On 19 Apr 2015, at 19:16, Parrot Raiser 1parr...@gmail.com wrote: Apress have some books about Perl 6, http://www.apress.com/catalogsearch/result/?q=perl+6submit=Go but their dates of publishing, (c 2006) make me suspect that they are probably outdated to the point of being misleading.

Re: Scheduler problem with scheduled events

2015-05-02 Thread Elizabeth Mattijsen
On 01 May 2015, at 13:57, mt1957 mt1...@gmail.com wrote: Reading though synopsis S17 concurrency I tried the following $*SCHEDULER.cue: in=10, { say 10s later } which will deliver the string after 10 seconds. However the moar will work like hell at a 100% cpu time before and afterwards!

Re: Will Perl 6 save a compiled version of a source program like Python?

2015-05-18 Thread Elizabeth Mattijsen
On 18 May 2015, at 14:28, Tom Browder tom.brow...@gmail.com wrote: I found some discussion of such a capability on the Perl Mongers' site but haven't found anything official yet in the Synopses. But I did find there an option that might do something related: --output-format (which is

Re: Passing a hash to a subroutine: best method?

2015-07-03 Thread Elizabeth Mattijsen
On 03 Jul 2015, at 17:26, Tom Browder tom.brow...@gmail.com wrote: While experimenting I've found the first two methods of passing a hash to a subroutine work: # method 1 my %hash1; foo1(%hash1); say %hash1.perl; sub foo1(%hash) { %hash{1} = 0; } # method 2 my %hash2; my $href2

Re: questions about qw<>

2015-10-13 Thread Elizabeth Mattijsen
> On 13 Oct 2015, at 17:15, Marc Chantreux wrote: > > hello, > > playing with <>, two questions came to my mind: > > a) why isn't it "regular" ? > >use Test; >ok < foo bar bang > ~~ List, "a list"; >ok < foo bar > ~~ List, "a list"; >ok < foo >

Re: questions about qw<>

2015-10-13 Thread Elizabeth Mattijsen
> On 13 Oct 2015, at 20:21, Marc Chantreux <kha...@phear.org> wrote: > On Tue, Oct 13, 2015 at 05:59:04PM +0200, Elizabeth Mattijsen wrote: > an unnamed hash ? does it make sense? sub h() { my % = a => 42, b => 666 }; dd h Just another way to create an anonymous hash. Liz

Re: What are Perl 6's killer advantages over Perl 5?

2015-08-26 Thread Elizabeth Mattijsen
On 26 Aug 2015, at 12:18, H.Merijn Brand h.m.br...@xs4all.nl wrote: On Wed, 26 Aug 2015 10:26:23 +0200, Moritz Lenz mor...@faui2k3.org wrote: I could continue with other Perl 5 deficiencies (no strict by default, Using strict *STILL* is not enabled by default for perl6 one-liners

Re: Strict Rakudo version of this Perl5 one-liner

2015-09-02 Thread Elizabeth Mattijsen
> On 02 Sep 2015, at 14:02, Matija Papec wrote: > 02.09.2015, 10:46, "The Sidhekin" : >>> So it seems that perl6 handles lexicals inside while (<>){} one-liners >>> differently. >> >>Ah, yes. Interesting. Run-time effect of C not happening >>

Re: How to push a hash on an array without flattening it to Pairs?

2015-09-26 Thread Elizabeth Mattijsen
> On 26 Sep 2015, at 13:09, Aristotle Pagaltzis wrote: > * Moritz Lenz [2015-09-26 09:40]: >> A trailing comma helps: >> >> my %h = a => 1, b => 2; >> my @a = %h, ; >> say @a.perl;# [{:a(1), :b(2)},] > > I think I understand why, but wow, that’s not

Re: require on string stopped working in rakudo 2015.09

2015-09-26 Thread Elizabeth Mattijsen
> On 26 Sep 2015, at 06:47, Gabor Szabo wrote: > I am really glad Rakudo finally came out. > I've installed in and tried to run the tests of Perl6::Maven. > > They quickly failed as I have been using 'require' on string > to check if all the module compile properly. > > The

Re: How to push a hash on an array without flattening it to Pairs?

2015-09-26 Thread Elizabeth Mattijsen
> On 26 Sep 2015, at 14:26, Aristotle Pagaltzis <pagalt...@gmx.de> wrote: > * Elizabeth Mattijsen <l...@dijkmat.nl> [2015-09-26 13:20]: >> There is: you just need to itemize the hash, e.g. by prefixing it with $ >> >> $ 6 'my %h = a => 42, b => 666; my @

Re: Constants as members of a class

2015-12-18 Thread Elizabeth Mattijsen
> On 18 Dec 2015, at 03:46, TS xx wrote: > > Hello dear perl6 users, > > I was in the need of declaring a member variable as a constant integer. After > many syntax tryouts I came to this one: > > class MyClass { > has int $.myConst; > > method new () { >

Re: Perl6 build failure on Ubuntu 14.04, 32-bit

2015-12-23 Thread Elizabeth Mattijsen
> On 23 Dec 2015, at 18:32, Tom Browder wrote: > > On Wed, Dec 23, 2015 at 10:38 AM, Steve Mynott wrote: >> That looks like you don't have enough virtual memory (the physical >> memory assigned to your VM and swap within it) should be at least 2GB

Re: Constants as members of a class

2015-12-18 Thread Elizabeth Mattijsen
> On 18 Dec 2015, at 23:37, TS xx wrote: > > Hi Liz, thanks for your reply. > > Can I call the method from static context? > I mean: MyClass.FOO In general, yes: class A { method FOO { 42 } # note the method doesn’t reference any attributes } say A.FOO; say

Re: '!' versus 'not' in boolean expression

2016-01-18 Thread Elizabeth Mattijsen
> On 18 Jan 2016, at 19:55, Tom Browder wrote: > > In creating some new Perl 6 programs I've run across several instances > I'm confused about, to wit: > > Example 1 > --- > >> my %h; say 'false' if !%h:exists; > Unexpected named parameter 'exists’ passed

2016.5,6 Rakudo Starring

2016-02-09 Thread Elizabeth Mattijsen
A new Perl 6 Weekly can be found at https://p6weekly.wordpress.com/2016/02/08/2016-56-rakudo-starring/ Liz

Re: A practical benchmark shows speed challenges for Perl 6

2016-02-03 Thread Elizabeth Mattijsen
> On 03 Feb 2016, at 14:59, Tom Browder wrote: > I use Perl for heavy duty text processing. A question on Perl Monks > about Perl 5's handling of a large input file got me wondering how the > two Perls compare at the moment. > > I wrote a couple of simple programs, in both

Re: Nice-to-have class methods

2016-01-27 Thread Elizabeth Mattijsen
> On 27 Jan 2016, at 14:00, Tom Browder wrote: > > Given so many handy methods for built-in classes, it would be nice to have a > couple of more for some, for instance: > > IO:Path.stemname > Like basename except any suffix is removed Seems like a nice idea. >

Re: A practical benchmark shows speed challenges for Perl 6

2016-03-30 Thread Elizabeth Mattijsen
> On 30 Mar 2016, at 16:06, yary <not@gmail.com> wrote: > > Cross-posting to the compiler group- > > On Wed, Mar 30, 2016 at 8:10 AM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: >> If you know the line endings of the file, using >> IO::Handle.split($

Re: A practical benchmark shows speed challenges for Perl 6

2016-03-31 Thread Elizabeth Mattijsen
> On 31 Mar 2016, at 09:50, Jan Ingvoldstad <frett...@gmail.com> wrote: > > On Wed, Mar 30, 2016 at 9:20 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: > > Thanks for your thoughts! > > I’ve implemented $*DEFAULT-READ-ELEMS in > https://github.com/rakudo/

Re: A practical benchmark shows speed challenges for Perl 6

2016-03-30 Thread Elizabeth Mattijsen
> On 30 Mar 2016, at 13:40, Tom Browder wrote: > On Tue, Mar 29, 2016 at 10:29 PM, Timo Paulssen wrote: >> On 03/30/2016 03:45 AM, Timo Paulssen wrote: >> >> Could you try using $filename.IO.slurp.lines instead of $filename.IO.lines >> and see if that

Re: A practical benchmark shows speed challenges for Perl 6

2016-04-01 Thread Elizabeth Mattijsen
> On 01 Apr 2016, at 13:50, Jan Ingvoldstad <frett...@gmail.com> wrote: > > On Thu, Mar 31, 2016 at 10:36 AM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: > > The reasoning behind _not_ setting things via environment variables, is > > that this means the progr

Re: Blobs and IEEE floating point

2016-04-19 Thread Elizabeth Mattijsen
> On 19 Apr 2016, at 12:03, Timo Paulssen wrote: > > On 19/04/16 01:58, Kevin Pye wrote: >> […] >> 2. Write a simple C function to take a pointer to a double and return >> the double, put that into a shared library and then use NativeCall. > >> […] > > > Fortunately, you

Re: Blobs and IEEE floating point

2016-04-19 Thread Elizabeth Mattijsen
FWIW, I’ll take PR’s for the PackUnpack distribution to make ‘f’ and ‘d’ work :-) > On 19 Apr 2016, at 07:28, JuhiMarcel LangbroekTimmerman > wrote: > > Hi Kevin > > I've made something up for the time being. You can find it in the BSON > module. Look for the file

Re: Killer Features of Perl 6

2016-08-20 Thread Elizabeth Mattijsen
> On 20 Aug 2016, at 22:14, Tony Edwardson wrote: > In a few weeks I will be presenting a talk on a technical meeting for Milton > Keynes Perl Mongers and I have decided to try and sell the benefits of Perl 6 > to a bunch of Perl 5 experts. > I am interested in your

Re: debugging and HookGrammar

2017-02-28 Thread Elizabeth Mattijsen
> On 28 Feb 2017, at 22:28, Theo van den Heuvel <vdheu...@heuvelhlt.nl> wrote: > Elizabeth Mattijsen schreef op 2017-02-28 20:29: >> That was the consensus on the #perl6-dev channel: >> https://irclog.perlgeek.de/perl6-dev/2017-02-28#i_14181744 >> Liz > > I

Re: for loop index question

2017-02-28 Thread Elizabeth Mattijsen
> On 28 Feb 2017, at 22:20, ToddAndMargo wrote: > > Hi All, > > There are times when I want to know th4e index of an array > when I am in a "for @array" loop. I can do it with a > variable outside the for loop and increment it, but > I would line to know know if there is

Re: coded size limits on Perl data types?

2016-09-13 Thread Elizabeth Mattijsen
> On 13 Sep 2016, at 14:15, Timo Paulssen wrote: > > I'll answer based on the data structures MoarVM uses internally: > > On 09/13/2016 05:13 AM, Darren Duncan wrote: > > > (Pretend the actual hardware has infinite memory so we wouldn't run > > out of hardware first.) > > >

Re: doubt about sequence operator

2016-10-10 Thread Elizabeth Mattijsen
> On 10 Oct 2016, at 14:22, Luca Ferrari wrote: > > Hi all, > I'm misunderstanding the ... operator. The following works as expected: > >@seq = ( 1, 2, -> $a, $b { $a * 2 + $b % 2 } ... * )[^10]; > > while the following seems to loop infinitely: > >@seq = ( 1,

Re: doubt about sequence operator

2016-10-10 Thread Elizabeth Mattijsen
> On 10 Oct 2016, at 14:22, Luca Ferrari wrote: > Looking at I > cannot find an explaination of why the ending value of 10 is not > honored in the second case. Oops, missed that you already referenced the doc: It’s in

Re: subset problem

2016-09-16 Thread Elizabeth Mattijsen
That’s because (elem) will coerce its righthand side parameter to a Bag. If the count in a Bag goes to 0, the element doesn’t exist, and therefore returns False. > On 16 Sep 2016, at 23:17, Brandon Allbery wrote: > > > On Fri, Sep 16, 2016 at 5:04 PM, yary

Re: subset problem

2016-09-16 Thread Elizabeth Mattijsen
I can’t help but think this can all be solved by using enums? my enum pv ( ); my pv $x = aa; ?? > On 16 Sep 2016, at 13:49, mt1957 wrote: > > Hi everyone, > > I am trying to create a subset but get errors when used. Surely I do > something wrong here or is it a bug? > >

Re: Startup performance on OS X

2016-10-03 Thread Elizabeth Mattijsen
> On 02 Oct 2016, at 11:00, Thor Michael Støre wrote: > Is this normal startup performance? https://www.promptworks.com/blog/public-keys-in-perl-6 I wonder what would be needed to run this in Perl 5, module wise, and CPU wise. Liz

Re: Initializing a CStruct attribute of a CStruct

2016-10-03 Thread Elizabeth Mattijsen
recently, jnthn fixed a bug in attribute binding of natives in signatures, so you should now be able to say: submethod BUILD(uint64 :$!c, test1 :$!d) { } # should work, but doesn't which in turn begs the question why you would need the BUILD anyway. But indeed it looks like you need to do

Re: Startup performance on OS X

2016-10-03 Thread Elizabeth Mattijsen
startups are like. > > > On Oct 3, 2016 06:14, "Elizabeth Mattijsen" <l...@dijkmat.nl> wrote: > > On 02 Oct 2016, at 11:00, Thor Michael Støre <thormich...@gmail.com> wrote: > > > > Hey everyone! > > > > Is this normal startup perfo

Re: serial communication over usb on linux

2017-01-02 Thread Elizabeth Mattijsen
> On 2 Jan 2017, at 23:49, Erik Colson wrote: > I'm considering to write a small IoT script in perl6. For this I need > serial communication as Perl5 has Device::SerialPort. As this module > has not (yet) been ported to perl6, I suppose I can achieve this with > Inline-ing.

Re: write string requires an object with REPR MVMOSHandle

2017-03-29 Thread Elizabeth Mattijsen
> On 29 Mar 2017, at 12:36, Shlomi Fish wrote: > > On Wed, 29 Mar 2017 12:10:15 +0200 > Timo Paulssen wrote: > >> As part of the IOwesome grant, zoffix is going to fix this error. It's >> what you get when you try to write to or read from or do

Re: Failed to open file .. too many open files

2017-03-25 Thread Elizabeth Mattijsen
$file.IO.slurp and slurp($file) are basically the same. $handle.slurp-rest does *not* close the handle, as another process might still be writing to it, so you could do another .slurp-rest. To get back to your original code: get '/atom' => sub { my $path = $.meta ~ request.path;

Re: Question for the developers on splice

2017-03-21 Thread Elizabeth Mattijsen
> On 21 Mar 2017, at 10:00, ToddAndMargo wrote: > on this command: > > perl6 -e 'my @foo = ; @foo.splice(0,3); say @foo;' > > Are you actually moving one set up data into another set's > element/slot/index, or are you just rearranging the pointers > to each element? How

Re: RFE: throw an error on a single "="when used in an "if"

2017-03-18 Thread Elizabeth Mattijsen
(This time to the list) > On 18 Mar 2017, at 10:19, ToddAndMargo wrote: > Request for Enhancement: > > Would you consider throwing a compiler error on the following: > > perl6 -e 'my $x=2;my $y=3; if $x = $y {say "yes";} else {say "no";}’ > yes FWIW, I don’t think that

Re: maintainability and "or"

2017-03-21 Thread Elizabeth Mattijsen
> On 21 Mar 2017, at 12:38, ToddAndMargo wrote: > This is just one of those chatter posts. > > To me, the holy grail of coding is maintainability, > which is why I code in Top Down. > > Code like below get my goat because I have to look > at it several times before I

Re: Associative collection with automatic keys?

2017-04-04 Thread Elizabeth Mattijsen
> On 4 Apr 2017, at 11:31, Trey Ethan Harris wrote: > > I'm thinking of a Hash-like collection where I can add objects using a > index-less append operation, but then have random access to the elements > based on a key provided by the object. (For instance, imagine a

Re: I need help with pattern matching

2017-03-13 Thread Elizabeth Mattijsen
> On 13 Mar 2017, at 08:27, ToddAndMargo wrote: > > Hi All, > > What am I doing wrong here? > > $ perl6 -e 'my $x="abc\(123\)def"; $x ~~ m/(abc\))(123)(\(def)/; say > "$x\n\$0=<$0> \$1=<$1> \$2=<$2>\n";' > > Use of Nil in string context > in block at -e line 1 >

Re: preassigned names in pattern matches?

2017-03-14 Thread Elizabeth Mattijsen
> On 14 Mar 2017, at 02:04, ToddAndMargo <toddandma...@zoho.com> wrote: > On 03/13/2017 02:21 PM, Elizabeth Mattijsen wrote: >>> On 13 Mar 2017, at 22:17, ToddAndMargo <toddandma...@zoho.com> wrote: >>> I adore this feature of loops: >>> >>&

Re: What to do when a pattern match fails

2017-03-13 Thread Elizabeth Mattijsen
> On 13 Mar 2017, at 22:06, ToddAndMargo wrote: > > Hi All, > > $ perl6 -e 'my $x="ab12cd"; $x ~~ m/ab(1q2)cd/; say "$x\n\$0=<$0>\n";' > Use of Nil in string context in block at -e line 1 > ab12cd > $0=<> > > With out the "q" in this, it works. I deliberately put >

Re: debugging and HookGrammar

2017-02-28 Thread Elizabeth Mattijsen
That was the consensus on the #perl6-dev channel: https://irclog.perlgeek.de/perl6-dev/2017-02-28#i_14181744 Liz > On 28 Feb 2017, at 15:24, Theo van den Heuvel wrote: > > Hi Will, > > I reinstalled without rakudobrew. It helped. I will probably never

Re: How to limit the list of imported functions?

2017-04-07 Thread Elizabeth Mattijsen
https://docs.perl6.org/syntax/need > On 7 Apr 2017, at 16:59, Gabor Szabo wrote: > > Thanks. I was only looking at https://docs.perl6.org/syntax/use > > Looking at that doc you linked to, I have a related quest I could not see: > > Is there a way to tell Rakudo to not to

Re: String to array problem

2017-07-17 Thread Elizabeth Mattijsen
> On 17 Jul 2017, at 11:08, Brent Laabs wrote: > All of this is to say that I wish the Str.words method had a way of applying > Perl 6 quoting rules as if it were the qww operator. Wouldn’t that be either .split or .comb? Liz

Re: Is there a bash/shlex-like processor with double-quotes handling?

2017-07-14 Thread Elizabeth Mattijsen
zef install Text::CSV This is a native port of Perl 5’s Text::CSV by the original author. > On 14 Jul 2017, at 11:12, Philip Hazelden wrote: > > If you haven't yet, you might want to look into a CSV parser. I think that if > you configure one of those to split on

Re: Where's the filter command?

2017-07-18 Thread Elizabeth Mattijsen
> On 18 Jul 2017, at 11:45, Mark Carter wrote: > > > > On 18/07/2017 09:53, Brent Laabs wrote: >> Are you looking for grep()? https://docs.perl6.org/routine/grep > Ah yes. Thanks for that. > Pretty good: > > say ($schema.lines().map: ).grep: { .elems() > 0; } ; say

Re: ping TImo: buf as a print

2017-07-09 Thread Elizabeth Mattijsen
> On 9 Jul 2017, at 07:32, ToddAndMargo wrote: > > On 07/08/2017 02:58 AM, timo wrote: >> @ToddAndMargo here's how to create an >> email with attachments: >> my $image = "P5\n64 64\n255\n".encode("utf8") ~ Buf[int8].new( do for >>

Re: set (+) set = bag ?

2017-07-21 Thread Elizabeth Mattijsen
> On 21 Jul 2017, at 21:30, Darren Duncan wrote: > > On 2017-07-21 5:07 AM, Timo Paulssen wrote: >> You want (|) to get the union of two sets as a set. >> >> https://docs.perl6.org/language/setbagmix#Set%2FBag_Operators >> >> hth >> - Timo > > Right. Every set

Re: Announce: Rakudo Star Release 2017.07

2017-07-25 Thread Elizabeth Mattijsen
ommunity and not anyone in particular. > > On 25 July 2017 at 17:00, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: >>> On 25 Jul 2017, at 05:57, ToddAndMargo <toddandma...@zoho.com> wrote: >>> On 07/24/2017 11:40 AM, Steve Mynott wrote: >>>> A useful

Re: Announce: Rakudo Star Release 2017.07

2017-07-25 Thread Elizabeth Mattijsen
> On 25 Jul 2017, at 05:57, ToddAndMargo wrote: > On 07/24/2017 11:40 AM, Steve Mynott wrote: >> A useful and usable production distribution of Perl 6 >> On behalf of the Rakudo and Perl 6 development teams, I'm pleased to >> announce the July 2017 release of "Rakudo Star",

Re: accepting values on the command line

2017-07-01 Thread Elizabeth Mattijsen
> On 1 Jul 2017, at 15:15, Gabor Szabo wrote: > > I was hoping to wrote a simple script that would accept a bunch of > filenames on the command line so I wrote: > > #!/usr/bin/env perl6 > use v6; > > multi sub MAIN(@files) { >say @files.perl; > } This signature will

Re: Version of a Module

2017-06-28 Thread Elizabeth Mattijsen
> On 28 Jun 2017, at 14:01, Martin Barth wrote: > but your approach means you have to state the version in the META6.json AND > in the Module.pm6 file again. This would be the similar to having $VERSION in > perl5. Shouldnt there be a simpler way? Isn’t that info available

Re: Need awk print sub

2017-08-04 Thread Elizabeth Mattijsen
> On 4 Aug 2017, at 22:00, ToddAndMargo wrote: > > Hi All, > > How do I do this with a perl one liner? > > $ echo "a b c d" | awk '{print $2}' > b echo "a b c d" | perl6 -e 'say words[1]’ Note array indices in Perl 6 are 0 based.

Re: another one liner

2017-08-05 Thread Elizabeth Mattijsen
> On 5 Aug 2017, at 09:21, ToddAndMargo wrote: > > On 08/04/2017 08:43 PM, Bruce Gray wrote: >> P6-ish version: >> ifconfig | perl6 -e 'say lines.map({ ~$0 if /^(\S+) ": flags="/ }).sort[1]' > > Would some kind person please tell me what is going on here? say the result

Re: another one liner

2017-08-05 Thread Elizabeth Mattijsen
> On 5 Aug 2017, at 08:50, Sean McAfee wrote: > > On Fri, Aug 4, 2017 at 10:18 PM, ToddAndMargo wrote: > On 08/04/2017 08:43 PM, Bruce Gray wrote: > > P6-ish version: > ifconfig | perl6 -e 'say lines.map({ ~$0 if /^(\S+) ": flags="/ }).sort[1]' > > >

Re: Task::Star and Panda

2017-05-23 Thread Elizabeth Mattijsen
> On 23 May 2017, at 19:23, ToddAndMargo wrote: > > On 05/23/2017 06:30 AM, Will Coleda wrote: >> Removed? It's still available athttps://github.com/tadzik/panda … > > It is on its way out. The developers over on the chat > line directed me to zef when I asked for help

Re: Task::Star and Panda

2017-05-23 Thread Elizabeth Mattijsen
> On 23 May 2017, at 20:21, ToddAndMargo <toddandma...@zoho.com> wrote: > On 05/23/2017 10:47 AM, Elizabeth Mattijsen wrote: >>> On 23 May 2017, at 19:23, ToddAndMargo <toddandma...@zoho.com> wrote: >>> >>> On 05/23/2017 06:30 AM, Will Coleda wrot

Re: Invoking method by name found in variable

2017-05-23 Thread Elizabeth Mattijsen
> On 23 May 2017, at 20:01, Gabor Szabo wrote: > given an object $o and the name of a method in $method = "run" > how can I invoke the $o.run() ? > > Something like $o.call($method) $o.”$method"() $ 6 'my $method = "Str"; dd 42."$method"()' “42" Liz

Re: problem converting Inf and NaN

2017-05-27 Thread Elizabeth Mattijsen
> On 27 May 2017, at 23:22, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: >> On 27 May 2017, at 19:33, Marcel Timmerman <mt1...@gmail.com> wrote: >> In perl6 version 2017.04.3-287-g3e7675a built on MoarVM version >> 2017.04-64-g6d5ea04 >> implementing Perl

Re: problem converting Inf and NaN

2017-05-27 Thread Elizabeth Mattijsen
> On 27 May 2017, at 19:33, Marcel Timmerman wrote: > In perl6 version 2017.04.3-287-g3e7675a built on MoarVM version > 2017.04-64-g6d5ea04 > implementing Perl 6.c. I observe the following; > > my Num $num = Inf; > my FatRat $f = $num.FatRat; > Type check failed in

Re: naming a class

2017-05-28 Thread Elizabeth Mattijsen
> On 28 May 2017, at 11:49, Marcel Timmerman wrote: > I've a question about naming a specific class. It is about the type > Decimal128 which I need in BSON. For the moment I want it to hold a number > and in BSON to encode and decode it to a byte stream. Later I can add >

Re: zef, zef-j, zef-m

2017-05-29 Thread Elizabeth Mattijsen
> On 29 May 2017, at 17:33, Fernando Santagata > wrote: > > On Mon, May 29, 2017 at 12:20 PM, Brent Laabs wrote: > > On 29 May 2017, at 11:22, Fernando Santagata > > wrote: > > > > /me sighs: NQP is still so poorly

Re: Get Better error message that "is trait on $-sigil variable not yet implemented. Sorry."?

2017-05-26 Thread Elizabeth Mattijsen
Fixed with https://github.com/rakudo/rakudo/commit/f2fca0c8c2 . > On 26 May 2017, at 10:47, Brent Laabs wrote: > > To file a bug in Rakudo, you should email rakudo...@perl.org. > > If it's a better error message you want, put "LTA Error" in the email subject > somewhere.

Re: zef, zef-j, zef-m

2017-05-29 Thread Elizabeth Mattijsen
10 AM, Brent Laabs <bsla...@gmail.com> wrote: > This works without a module on Rakudo: > > use nqp; > my $path = "foo".IO; > my $hardlink-count = nqp::stat($path.absolute, > nqp::const::STAT_PLATFORM_NLINKS); > > > > > On Mon, May 29, 2017 at 1:54 AM,

Re: Creating an array of a single hash

2017-06-02 Thread Elizabeth Mattijsen
> On 1 Jun 2017, at 16:29, Gabor Szabo wrote: > > use v6; > > my @x = { name => "Foo" }, { name => "Bar"} > say @x.gist; # [{name => Foo} {name => Bar}] > say @x.^name;# Array > say @x[0].^name; # Hash > > my @y = { name => "Foo" } > say @y; # [name => Foo]

Re: How to deriving own distinguish type from Int?

2017-05-31 Thread Elizabeth Mattijsen
> On 31 May 2017, at 12:25, cle-pe...@qiao.in-berlin.de wrote: > > Hello, > > I am already following Perl 6 since many years. But only recently as books > began to appear, I began to really learn it. > > One of the many things I like on Perl 6 is its static typing possibility. I > am used to

Re: The speed (improvement) of Rakudo

2017-06-17 Thread Elizabeth Mattijsen
> On 17 Jun 2017, at 13:12, Tom Browder wrote: > On Fri, Jun 16, 2017 at 23:47 Gabor Szabo wrote: >> Is there some measurements regarding the speed of Rakudo? > > Perl 6 is still very slow on IO compared to Perl 5. I have a > read/write test suite I've

Re: contains question

2017-06-12 Thread Elizabeth Mattijsen
IOW, overload .contains() with Str and Regex > > F > > On 06/12/2017 10:42 AM, Elizabeth Mattijsen wrote: >>> On 12 Jun 2017, at 01:27, ToddAndMargo <toddandma...@zoho.com> wrote: >>> perl6 -e 'my $x = "\t"; if $x !~~ /<[A..Z a..z 0..9]>/

Re: contains question

2017-06-12 Thread Elizabeth Mattijsen
> On 12 Jun 2017, at 01:27, ToddAndMargo wrote: > perl6 -e 'my $x = "\t"; if $x !~~ /<[A..Z a..z 0..9]>/ {say "out"} else {say > "in"}' > > Would this be easier to do with $x.contains? Or would it > be too worky? .contains only takes a *single string* to look up. So

Re: Perl 6 ignores SIGPIPE

2017-06-16 Thread Elizabeth Mattijsen
> On 16 Jun 2017, at 08:34, Sean McAfee wrote: > > I see at > > http://www.moarvm.com/releases.html > > ...that as of the 2017.03 release, Perl 6 "ignores SIGPIPE by default." I > discovered this for myself when I piped a program that generates unlimited > output to the

Re: How do you call the variable types?

2017-06-16 Thread Elizabeth Mattijsen
> On 16 Jun 2017, at 06:23, Gabor Szabo wrote: > > On Sat, Jun 10, 2017 at 9:38 AM, Brent Laabs wrote: >> I thought: >> $ is Scalar >> @ is Array >> % is Hash >> & is a function >> > > Reading this https://docs.perl6.org/language/containers I just found

Re: Perl 6 ignores SIGPIPE

2017-06-16 Thread Elizabeth Mattijsen
> On 16 Jun 2017, at 14:10, Jan Ingvoldstad <frett...@gmail.com> wrote: > > On Fri, Jun 16, 2017 at 12:13 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: > > Failed to write bytes to filehandle: Broken pipe > in block at -e line 1 > > So it would appear

Re: getting help in the REPL

2017-06-16 Thread Elizabeth Mattijsen
> On 14 Jun 2017, at 16:07, Gabor Szabo wrote: > On Wed, Jun 14, 2017 at 4:44 PM, Timo Paulssen wrote: >> WHY and WHEREFOR are "fully" supported, it's just that we've not put any >> pod into the core setting and we don't have helper code that loads it >>

Re: Undeclared routine: break used at line ...

2017-06-13 Thread Elizabeth Mattijsen
> On Tue, Jun 13, 2017 at 8:50 PM, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: >>> On 13 Jun 2017, at 19:34, Gabor Szabo <szab...@gmail.com> wrote: >>> >>> I just managed to write >>> >>> while True { >>> ... >>>

Re: can't adverb and infix

2017-09-20 Thread Elizabeth Mattijsen
> On 19 Sep 2017, at 13:04, Brandon Allbery wrote: > > On Tue, Sep 19, 2017 at 3:44 AM, Luca Ferrari wrote: > this will sound trivial, but the following piece of code that in my > mind should work does not: > > $mode = 'csv' if ( ! $mode.defined ||

Re: bash and pm6 question

2017-09-21 Thread Elizabeth Mattijsen
> On 22 Sep 2017, at 00:32, Bennett Todd wrote: > > With perl5, that could have been something like. "perl -Mmy -e ...", but I > don't have access to a perl6 at this instant to compare. There should be a > flag you can use to include a module into the.running

Re: Thread example from evanmiller

2017-09-11 Thread Elizabeth Mattijsen
> On 8 Sep 2017, at 05:16, Norman Gaywood wrote: > > Several weeks ago there was this post: > http://www.evanmiller.org/why-im-learning-perl-6.html > > That gave this example of perl6 N:M threads in action: > > use v6.d.PREVIEW; > > my $channel = Channel.new; > > my

Re: Are 64 bit natives universally available?

2017-08-27 Thread Elizabeth Mattijsen
They have been available since Christmas, afaik. > On 27 Aug 2017, at 22:42, David Warring wrote: > > Quick question. > > I just want to doublle check that int64, uint64 are universally available > via Perl 6, before introducing them into modules. e.g. > % perl6

Re: thread behavior

2017-09-04 Thread Elizabeth Mattijsen
> On 4 Sep 2017, at 10:44, JuhiMarcel LangbroekTimmerman > wrote: > Thanks for your anwer. I assume there are a few things I can rely on; > - the main thread is where the code starts and will always have id 1 That can not be relied on in general, I’m afraid. However, after

Re: thread behavior

2017-09-04 Thread Elizabeth Mattijsen
> On 4 Sep 2017, at 09:29, Marcel Timmerman wrote: > I was wondering about the following, > > When an Exception is thrown in a thread and is CATCHed in another object, > will that block be run in the same thread as the Exception is thrown? I think from 6.d onward, you can

Re: Set difference using hashes vs array

2017-11-23 Thread Elizabeth Mattijsen
Will have a look at this in about 12 hours (probably). Meanwhile, don’t let that stop anyone from figuring this out :-) > On 23 Nov 2017, at 05:27, Norman Gaywood wrote: > > Talking to myself :-) > > Seems it has something to do with the values in the hash. If they

Re: The equivalent of Moose's "around"

2017-11-17 Thread Elizabeth Mattijsen
> On 17 Nov 2017, at 20:09, Fernando Santagata > wrote: > I tried to use the code you suggested: > > sub trait_mod:(Attribute:D \attribute, :!) { > attribute.package.^add_method(attribute.name, my method () { proxy($_) }) > } > > class A { > has $!a is proxy({

Re: The equivalent of Moose's "around"

2017-11-17 Thread Elizabeth Mattijsen
> On 17 Nov 2017, at 20:09, Fernando Santagata > wrote: > I tried to use the code you suggested: > > sub trait_mod:(Attribute:D \attribute, :!) { > attribute.package.^add_method(attribute.name, my method () { proxy($_) }) > } > > class A { > has $!a is proxy({

Re: The equivalent of Moose's "around"

2017-11-16 Thread Elizabeth Mattijsen
Oops, > On 17 Nov 2017, at 01:24, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: > sub trait_mod:(\attribute, :!) is export { sub trait_mod:(Attribute:D \attribute, :!) is export { so that the trait can only be used on Attribute objects. Liz

Re: The equivalent of Moose's "around"

2017-11-16 Thread Elizabeth Mattijsen
s $!a; > has $!b; > submethod BUILD { > self.create(::A, 'a', $!a, { $^a * 2 }); > self.create(::A, 'b', $!b, { $^a * 3 }); > } > } > > my A $a .= new; > $a.a = 21; > say $a.a; # 42 > $a.b = 21; > say $a.b; # 63 > > > On Tue, Nov 14, 2017 at 7:09 P

Re: The equivalent of Moose's "around"

2017-11-14 Thread Elizabeth Mattijsen
> On 14 Nov 2017, at 18:06, Fernando Santagata > wrote: > I'm converting a program from Perl5/Moose. > I have several classes, each has some attributes that need to be processed in > the same way before being passed to other objects. > > When I was using Moose, I had

Re: The equivalent of Moose's "around"

2017-11-14 Thread Elizabeth Mattijsen
> } > > In this way I don't have to make an explicit call to the preprocessor any > time I assign a value to that attribute, effectively removing that from the > main program. > > I'm looking for a way to do that in Perl6. > > On Tue, Nov 14, 2017 at 6:11 PM, Eliza

Re: The equivalent of Moose's "around"

2017-11-17 Thread Elizabeth Mattijsen
> On 17 Nov 2017, at 22:47, Elizabeth Mattijsen <l...@dijkmat.nl> wrote: >> On 17 Nov 2017, at 20:09, Fernando Santagata <nando.santag...@gmail.com> >> wrote: >> I tried to use the code you suggested: >> >> sub trait_mod:(Attribute:D \attri

  1   2   3   4   >