Re: for loop index question

2017-02-28 Thread Andrew Kirkpatrick
The zip operator in this case takes two sequences and interleaves them into a single sequence. It might be useful if you have handy or can generate a list of keys and a list of values you want to put together in pairs using => to create a hash table. Your explicit approach makes sense for

Re: for loop index question

2017-02-28 Thread Todd Chester
On Wednesday, March 01, 2017 01:01 PM, Todd Chester wrote: Hi All, And it even gets more interesting. It even works with Associative Arrays (Hashes), which I adore! Interesting how associative arrays don't print in order that they were entered into the array. #!/usr/bin/perl6 my @x = (

Re: for loop index question

2017-02-28 Thread Richard Hainsworth
Instead of my %y = ( 'aa'=>"AA", 'bb'=> "BB", 'cc'=>"CC", 'dd'=>"DD" ); in the code below, I find the following useful for filling an associative array (when testing and I dont care about the contents) my %y = Z=> 'AA'..*; #{aa => AA, bb => AB, cc => AC, dd => AD} But if the contents

Re: for loop index question

2017-02-28 Thread Todd Chester
Hi All, And it even gets more interesting. It even works with Associative Arrays (Hashes), which I adore! Interesting how associative arrays don't print in order that they were entered into the array. #!/usr/bin/perl6 my @x = ( "a", "b", "c", "d" ); print "loop of \@x\n"; for @x.kv ->

Re: for loop index question

2017-02-28 Thread Todd Chester
On 02/28/2017 01:30 PM, yary wrote: Maybe using placeholder variables was a bit too much (those variables with the ^ twigil) for @a.kv -> $k, $v { say "Value $v has index $k" } Value g has index 0 Value h has index 1 Value i has index 2 Value j has index 3 Value k has index 4 Hi Yary,

Re: for loop index question

2017-02-28 Thread Todd Chester
On 02/28/2017 01:25 PM, Elizabeth Mattijsen wrote: 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,

Re: for loop index question

2017-02-28 Thread Todd Chester
On Tue, Feb 28, 2017 at 01:20:47PM -0800, 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 a way to incorporate

Re: for loop index question

2017-02-28 Thread Todd Chester
On 02/28/2017 01:20 PM, 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 a way to incorporate it in the loop

Re: Terminal::ANSIColor problem

2017-02-28 Thread Todd Chester
On 02/28/2017 04:11 AM, yary wrote: You don't need the double quotes around $Str- not even in Perl5! Hi Yary, You made me think of where I picked up that particular "bad habit". I go it, not from Perl 5, but from bash programming, where all h*** breaks loose if you don't quote things. :-)

[perl #130891] [LTA] Operator `o` always returns a Block with .arity 0 and .count Inf

2017-02-28 Thread via RT
# New Ticket Created by Sam S. # Please include the string: [perl #130891] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130891 > my = *+1; my = */2; say # 1 say # 1 say ( o ).arity;

Re: debugging and HookGrammar

2017-02-28 Thread Elizabeth Mattijsen
> On 28 Feb 2017, at 22:28, Theo van den Heuvel 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 wasn't aware of this. Thanks You’re

Re: for loop index question

2017-02-28 Thread yary
Maybe using placeholder variables was a bit too much (those variables with the ^ twigil) > for @a.kv -> $k, $v { say "Value $v has index $k" } Value g has index 0 Value h has index 1 Value i has index 2 Value j has index 3 Value k has index 4

Re: debugging and HookGrammar

2017-02-28 Thread Theo van den Heuvel
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 wasn't aware of this. Thanks -- Theo van den Heuvel

Re: for loop index question

2017-02-28 Thread yary
> my @a = ( 'g' .. 'k' ) [g h i j k] > @a.kv (0 g 1 h 2 i 3 j 4 k) > for @a.kv { say "Value $^v has index $^i" } Value g has index 0 Value h has index 1 Value i has index 2 Value j has index 3 Value k has index 4

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: for loop index question

2017-02-28 Thread Patrick R. Michaud
I think the canonical Perl 6 answer is: for @array.kv -> $index, $value { do something } Pm On Tue, Feb 28, 2017 at 01:20:47PM -0800, 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 >

for loop index question

2017-02-28 Thread ToddAndMargo
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 a way to incorporate it in the loop command. This is my long winded way of doing it

Hidden partitions question

2017-02-28 Thread ToddAndMargo
Hi All, In Windows 7 Pro, I know that several backup programs are able to manipulate files on hidden NTFS partitions. Is there a Perl6 way to do this? (I am trying to avoid mounting with a drive letter to end around ransomware.) Many thanks, -T -- ~ I am Windows I

Net::SMTP attachments?

2017-02-28 Thread ToddAndMargo
Hi All, Anyone know how to do an attachment with Net::SMTP. I need to attach a tar ball. I see this is Thunderbird's message source, but .. --0__=0ABB0A53DFD693F18f9e8a93df938690918c0ABB0A53DFD693F1 Content-type: image/gif; name="pic15602.gif" Content-Disposition: attachment;

Re: Terminal::ANSIColor problem

2017-02-28 Thread ToddAndMargo
On 02/28/2017 12:53 PM, Brandon Allbery wrote: On Tue, Feb 28, 2017 at 3:46 PM, ToddAndMargo > wrote: On 02/28/2017 04:11 AM, yary wrote: On Tue, Feb 28, 2017 at 12:53 AM, ToddAndMargo

Re: Terminal::ANSIColor problem

2017-02-28 Thread Brandon Allbery
On Tue, Feb 28, 2017 at 3:46 PM, ToddAndMargo wrote: > On 02/28/2017 04:11 AM, yary wrote: > >> >> On Tue, Feb 28, 2017 at 12:53 AM, ToddAndMargo > > wrote: >> >> sub PrintRed ( $Str ) { print color('bold'),

Re: Terminal::ANSIColor problem

2017-02-28 Thread ToddAndMargo
On 02/28/2017 04:11 AM, yary wrote: On Tue, Feb 28, 2017 at 12:53 AM, ToddAndMargo > wrote: sub PrintRed ( $Str ) { print color('bold'), color('red'), "$Str", color('reset'); } sub PrintGreen ( $Str ) { print color('bold'),

[perl #130874] [BUG] Nil value misdescribed at repl

2017-02-28 Thread Zoffix Znet via RT
On Mon, 27 Feb 2017 01:59:07 -0800, elizabeth wrote: > Fixed with https://github.com/rakudo/rakudo/commit/a274bdd122 , tests > needed Test added: https://github.com/rakudo/rakudo/commit/0f37dd38e0

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: debugging and HookGrammar

2017-02-28 Thread Brandon Allbery
On Tue, Feb 28, 2017 at 9:24 AM, Theo van den Heuvel wrote: > I reinstalled without rakudobrew. It helped. I will probably never know > what I did wrong with rakudobrew (possible traces of an older install). One thing it does wrong is it doesn't fetch tags for its repos,

[perl #130889] perl6 can't find file it just created

2017-02-28 Thread Zoffix Znet via RT
Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/76f71878da Test: https://github.com/perl6/roast/commit/908348eef1

[perl #130876] [BUG] repl error report suppressed by prior output

2017-02-28 Thread Zoffix Znet via RT
On Mon, 27 Feb 2017 16:53:02 -0800, zef...@fysh.org wrote: > Zoffix Znet via RT wrote: > >Fix: https://github.com/rakudo/rakudo/commit/61a65cee3d > > You've just moved the problem along. There's now a new class of > object that, if evaluated to, will be treated as if evaluation failed on >

[perl #130788] Incorrect treatment of EOL causes test failures on Windows

2017-02-28 Thread jn...@jnthn.net via RT
On Wed, 15 Feb 2017 10:11:01 -0800, si...@unur.com wrote: > $ perl t\harness5 t\spec\S17-procasync\basic.rakudo.moar > --verbosity=5 > ... > not ok 33 - Tapping stdout supply after start of process does not lose > data > > # Failed test 'Tapping stdout supply after start of process does not >

Re: debugging and HookGrammar

2017-02-28 Thread Theo van den Heuvel
Hi Will, I reinstalled without rakudobrew. It helped. I will probably never know what I did wrong with rakudobrew (possible traces of an older install). thanks, Theo Will Coleda schreef op 2017-02-28 14:37: FYI, rakudobrew is not recommend for users. You could try "rakudobrew rehash",

Re: [perl #130887] [BUG] .perl omits backtrace of exception

2017-02-28 Thread Zefram
Zoffix Znet via RT wrote: >Only public attributes of an object get dumped in .perl's output, >and backtrace isn't one: That's a fine default, but a problem in this case. The .backtrace method is public, so .perl.EVAL ought to be round-tripping the data that it exposes, however that's stored.

[perl #130887] [BUG] .perl omits backtrace of exception

2017-02-28 Thread Zoffix Znet via RT
On Mon, 27 Feb 2017 14:35:17 -0800, zef...@fysh.org wrote: > > try { my Int $a; $a = "foo" }; say ?$!.backtrace; say > > ?$!.perl.EVAL.backtrace > True > False > > .perl.EVAL is failing to round-trip the exception object, as > demonstrated > by the differing truthiness of the value returned by

Re: [perl #130886] multi subs with inconsistent where clauses don't work correctly

2017-02-28 Thread Timo Paulssen
I'd say this is NOTABUG via the DIHWIDT category. If your where clause has side-effects, you're bound to get in trouble. If you're fine with relying on internals, you can just put True into the one-out-of-ten three times at the end and the program will run through to 100. test 90 90

Re: debugging and HookGrammar

2017-02-28 Thread Will Coleda
FYI, rakudobrew is not recommend for users. You could try "rakudobrew rehash", though I'm not sure if that will help in this case. On Tue, Feb 28, 2017 at 7:55 AM, Theo van den Heuvel wrote: > hi everyone, > > last week I used rakudobrew to update my Perl6 installation on

debugging and HookGrammar

2017-02-28 Thread Theo van den Heuvel
hi everyone, last week I used rakudobrew to update my Perl6 installation on Ubuntu. This is Rakudo version 2017.02-106-gdd4dfb1 built on MoarVM version 2017.02-7-g3d85900 implementing Perl 6.c. Now, whenever I try perl6-debug-m I get Cannot find method 'setlang' on object of type

Re: Terminal::ANSIColor problem

2017-02-28 Thread yary
On Tue, Feb 28, 2017 at 12:53 AM, ToddAndMargo wrote: > sub PrintRed ( $Str ) { print color('bold'), color('red'), "$Str", > color('reset'); } > sub PrintGreen ( $Str ) { print color('bold'), color('green'), "$Str", > color('reset'); } > sub PrintBlue ( $Str ) { print