Re: : question

2017-07-28 Thread Brandon Allbery
On Fri, Jul 28, 2017 at 5:49 PM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 07/28/2017 02:41 PM, Brandon Allbery wrote:
>>>>
>>> > That's not Perl, it's JSON generated by Perl.
>
> Mumble, mumble ...  I have a hard enough time learning
> Perl without someone throwing in another language.
> Mumble ...
>

You're doing web stuff, it's going to get a lot worse before it gets
better. JSON, JavaScript, possibly having to deal with web support
components in other languages, 


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: : question

2017-07-28 Thread Brandon Allbery
That's not Perl, it's JSON generated by Perl.

On Fri, Jul 28, 2017 at 5:39 PM, ToddAndMargo  wrote:

> On 07/28/2017 02:02 PM, Timo Paulssen wrote:
>
>> The first one is valid perl 6 code and the bottom one is not. It's
>> likely you were looking at JSON (or equivalently JavaScript) and
>> confused that with perl6 code.
>>
>>
> Now I am really confused.  It is all over the place on
> http://perl6maven.com/simple-web-client
>
> For instance:
>
> {
>   "args": {
> "language": "Perl",
> "math": "19+23=42",
> "name": "Larry Wall"
>   },
>   "headers": {
> "Connection": "close",
> "Host": "httpbin.org",
> "User-Agent": "LWP::Simple/0.090 Perl6/rakudo"
>   },
>   "origin": "17.19.208.37",
>   "url": "http://httpbin.org/get?name=Larry Wall=Perl=19%2B2
> 3%3D42"
> }
>
>
> Confusedly yours,
> -T
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: another one liner

2017-08-05 Thread Brandon Allbery
On Sat, Aug 5, 2017 at 2:50 AM, 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]'
>>>
>>
>>
> Wait a second.  How does map skip input elements like that?
>
> > map { $_ if $_ %% 2 }, 1..10
> (2 4 6 8 10)
>
> > 1 if 1 %% 2
> ()
>
> But:
>
> > map { $_ %% 2 ?? $_ !! () }, 1..10
> (() 2 () 4 () 6 () 8 () 10)
>

Perl 5 doesn't do nested lists (unless you use arrayrefs) so () flattens
away. In Perl 6, to get a similar effect you produce Nil. As Nil is the
default value in that first block, it gets produced if the condition fails.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: How do I do SSL/TLS with eMail::MIME ?

2017-08-19 Thread Brandon Allbery
On Sun, Aug 20, 2017 at 12:55 AM, ToddAndMargo <toddandma...@zoho.com>
wrote:

> On 08/19/2017 09:51 PM, Brandon Allbery wrote:
>
>> I think you only want :starttls. :ssl tells it to expect a socket that
>> immediately negotiates SSL; the error suggests the mail server doesn't.
>> (Note that, because SSL is negotiated immediately, it must use different
>> ports; in general, a mail server that supports SSL uses port 465 instead of
>> 25, because it can't do SSL and non-SSL on the same port.)
>>
>> Also, SSL as such isn't used that much beyond HTTPS. Modern mail servers
>> are more likely to use negotiated encryption (STARTTLS) instead. So just
>> :starttls and not :ssl.
>>
> If I remove the :ssl and leave :starttls, it just hangs
>

Are you sure this server supports STARTTLS?
And if it really is SSL only then it probably doesn't *also* do
STARTTLS¸which is a newer protocol.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: How do I do SSL/TLS with eMail::MIME ?

2017-08-19 Thread Brandon Allbery
On Sun, Aug 20, 2017 at 12:41 AM, ToddAndMargo 
wrote:

> $client = Net::SMTP.new(:server( $smtp ), :port( $port ), :ssl, :starttls,
> :debug( 1 ) )
>

I think you only want :starttls. :ssl tells it to expect a socket that
immediately negotiates SSL; the error suggests the mail server doesn't.
(Note that, because SSL is negotiated immediately, it must use different
ports; in general, a mail server that supports SSL uses port 465 instead of
25, because it can't do SSL and non-SSL on the same port.)

Also, SSL as such isn't used that much beyond HTTPS. Modern mail servers
are more likely to use negotiated encryption (STARTTLS) instead. So just
:starttls and not :ssl.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: parameters from the command line: how do they do that?

2017-06-22 Thread Brandon Allbery
On Thu, Jun 22, 2017 at 1:51 AM, Todd Chester  wrote:

> You want named parameters.
>>
>> sub MAIN(:$fixed-string, :$extended-regex, ...) {
>>   # $fixed-string and $extended-regex are Bools here,
>>   # True if the corresponding option specified
>> }
>>
>> You should recognize this as being similar to named parameters work for
>> normal Perl 6 functions, but MAIN exposes them to the command line like
>> GNUish long options.
>>
>>
> What does the ":" do?  and does it give you back the
> value associated with it, if there is one?


I guess that means you did not recognize colon-pair syntax for named
parameters.

https://docs.perl6.org/language/terms#Pair see at the end for their use as
named parameters.

Since I assume I'm going to have to read that link for someone on the list
anyway:

:name(value)
:name
:name
:!name
:$name

are all colon-pairs. When used as parameters, they indicate named (as
opposed to positional) parameters.

The first form allows you to associate any variable name with the parameter
name, optionally with a type. The second form is always a String (and any
of the bracketing String forms can be used, e.g. :foo<> --- but *not*
:foo"bar"; that would need to use the first form). The final three are
always Bools; the last one takes the parameter name from the variable name.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: parameters from the command line: how do they do that?

2017-06-21 Thread Brandon Allbery
On Thu, Jun 22, 2017 at 1:18 AM, Todd Chester  wrote:

> > On 22/06/17 14:49, Todd Chester wrote:
> >> I know how to read things on the command line.  But
> >> how to other's figure out what goes together when things
> >> don't arrive in order?
>
>
> On 06/21/2017 10:03 PM, Francis (Grizzly) Smit wrote:
>
>> look into function MAIN in perl6
>>
>> https://docs.perl6.org/language/functions
>>
>> https://perl6advent.wordpress.com/2010/12/02/day-2-interacti
>> ng-with-the-command-line-with-main-subs/
>>
>
>
> But they have to be in order.
>

You want named parameters.

sub MAIN(:$fixed-string, :$extended-regex, ...) {
  # $fixed-string and $extended-regex are Bools here,
  # True if the corresponding option specified
}

You should recognize this as being similar to named parameters work for
normal Perl 6 functions, but MAIN exposes them to the command line like
GNUish long options.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Rakudo on JVM?

2017-05-16 Thread Brandon Allbery
On Tue, May 16, 2017 at 4:18 PM, Stephen Wilcoxon 
wrote:

> I see in the release notes for Rakudo 2017.04, it basically says not to
> use JVM backend.  Why is this?  Has support for the JVM been dropped?


Not dropped; it's just that the JVM backend has always been more difficult,
and is often (as now) broken because changes at the rakudo or nqp level
require backend changes to match and there's fewer people working on the
JVM backend. (Yes, JVM is popular, but JVM bytecode is kinda ridiculous and
difficult to use for anything but Java or Java-derived languages like
Scala.) It's hoped the next release will be more usable.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: next

2017-06-16 Thread Brandon Allbery
On Fri, Jun 16, 2017 at 9:02 PM, ToddAndMargo  wrote:

> I am afraid I am not understanding "next" again.
>
> When you invoke it, does it pop you back at the start of
> the loop or just cough up the next value?
>

The former. Or you can think of it as jumping past everything else in the
loop body so the next thing it does is get the next value and run the loop
body with it.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need p5 to p6 help

2017-06-11 Thread Brandon Allbery
On Sun, Jun 11, 2017 at 6:52 PM, ToddAndMargo  wrote:

> P6:
> $ perl6 -e 'my $x="\t"; if !~ /[^A-Za-z0-9]/ {say "outside"} else {say
> "inside"};'
>

You missed a "$x" in there.

Negation works differently in perl 6 regex. /<-[A..Z a..z 0..9]>/

pyanfar «work*master» Z$ 6 'my $x = "["; if $x !~~ /<-[A..Z a..z 0..9]>/
{say "out"} else {say "in"}'
in
pyanfar «work*master» Z$ 6 'my $x = "c"; if $x !~~ /<-[A..Z a..z 0..9]>/
{say "out"} else {say "in"}'
out


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: How do you call the variable types?

2017-06-15 Thread Brandon Allbery
On Sat, Jun 10, 2017 at 2:38 AM, Brent Laabs  wrote:

> I thought:
> $ is Scalar
> @ is Array
> % is Hash
> & is a function
>

Pedantically:

$ forces item context, but otherwise allows any type (defaulting to
Scalar); the item context gets you "scalar" behavior in most cases even
with non-scalars
@ forces a Positional constraint (which defaults to Array)
% forces an Associative constraint (which defaults to Hash)
& forces a Callable constraint (no default, I think)

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: next

2017-06-18 Thread Brandon Allbery
On Mon, Jun 19, 2017 at 12:41 AM, ToddAndMargo 
wrote:

> On 06/17/2017 12:22 AM, yary wrote:
>
>> last if ++$true_count == 6;
>>
>
> ++$true_count
>
> Is that the same as `$true_count + 1` ?
>
> And does it alter the value of $true_count
>

Yes and yes, just like in C and Perl 5; note that being preincrement, it
changes the variable's value *before* it is retrieved, whereas
"$true_count++" would change it *after*.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Any "note" without the "say"?

2017-09-15 Thread Brandon Allbery
On Fri, Sep 15, 2017 at 3:48 PM, ToddAndMargo  wrote:

> Is there a similar "print" to the STDERR for when
> you don't want the cr-lf inserted?
>
> The hard way:
> $*ERR.print: "print to std err\n";
>

That's it. It's not really common enough to deserve something shorter.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: can't adverb and infix

2017-09-19 Thread Brandon Allbery
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 || %available_modes{ $mode }:!exists );
>
> and the compiler says:
>
> You can't adverb :<||>
>

You want the adverb to be on the postcircumfix; parenthesize the
expression. IIRC this was considered the least bad alternative out of an
ambiguous parse (i.e. which operation does the adverb apply to?).

$mode = 'csv' if ( ! $mode.defined || (%available_modes{ $mode
}:!exists) );

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Why can't I "write"?

2017-09-23 Thread Brandon Allbery
On Sat, Sep 23, 2017 at 3:31 PM, Brandon Allbery <allber...@gmail.com>
wrote:

> On Sat, Sep 23, 2017 at 2:09 AM, ToddAndMargo <toddandma...@zoho.com>
> wrote:
>
>>   method write(IO::Handle:D: Blob:D $buf --> True)
>>
>
> The key here is the colon *after* `IO::Handle:D`: that marks the Handle as
> an invocant, i.e. this is a method to be applied to an object. (The fact
> that it has a `type smiley`, i.e. another colon before that, doesn't help
> with deciphering the signature)
>

I should also mention that that colon also shows how you can call write as
a sub: use a colon instead of a comma after the Handle.

write($myHandle: whatever);

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Why can't I "write"?

2017-09-23 Thread Brandon Allbery
On Sat, Sep 23, 2017 at 2:09 AM, ToddAndMargo  wrote:

>   method write(IO::Handle:D: Blob:D $buf --> True)
>

The key here is the colon *after* `IO::Handle:D`: that marks the Handle as
an invocant, i.e. this is a method to be applied to an object. (The fact
that it has a `type smiley`, i.e. another colon before that, doesn't help
with deciphering the signature)

I have to think there's a better way to document these things than to
expose what probably ought to be treated as an advanced feature of
Captures

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: overwrite?

2017-09-23 Thread Brandon Allbery
On Sat, Sep 23, 2017 at 2:34 AM, ToddAndMargo  wrote:

> I see ":truncate".  This seems liek it will do the trick.
> Problem: I would like to read from the file first before
> truncating (ro).
>
> Is there a way to do this, or should I
>1) open the handle with :ro
>2) read what I want from it
>3) close the handle
>4) reopen the handle with :w and overwrite what I want?
>

You have to do it the long way. I don't think we expose a binding to
ftruncate() that would let you open it r/.w, red from it, truncate, and
write.

That said, there's actually a good reason for that: is it okay to trash the
file if something goes wrong? You might prefer to *rename* the old file
instead of overwriting, so you can recover if necessary.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: help with map and regexp

2017-09-21 Thread Brandon Allbery
On Thu, Sep 21, 2017 at 2:37 AM, Luca Ferrari  wrote:

> Out of cursiosity: what is the diffence between using "is copy" and "<->"?
> Seems to me the map example can work with both.
>

<-> is the same as "is rw" and requires that the thing being bound be a
mutable container, which will be altered if the binding is. "is copy"
instead creates a new mutable container holding a copy of the thing being
bound, so that changes to it are possible but won't affect the original.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Any "note" without the "say"?

2017-09-15 Thread Brandon Allbery
On Fri, Sep 15, 2017 at 4:51 PM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 09/15/2017 01:29 PM, Brandon Allbery wrote:
>
>> Everyone does at one time :) It's really useful for debugging, but you
>> generally strip it out of production code.
>>
>
> I saw a business study somewhere (I don't remember where)
> that determined that the notes folks doodle into the margins on
> working papers are often time more useful than the papers
> themselves.  One wonders how much of this happens in Perl!
>

That'd be comments, actually. Sadly, the same rule doesn't seem to apply;
programmers are terrible at writing useful comments for the most part.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: :: question

2017-09-13 Thread Brandon Allbery
On Thu, Sep 14, 2017 at 12:46 AM, ToddAndMargo 
wrote:

> What is the Perl6 equivalent of the perl 5 "::"?
>
> $Found = CheckSystemDependancy::Which ( $ProgramName, $HowToExit );
>

It's the same... but unlike Perl 5, there is a difference between subs and
methods, and subs are lexical by default (that is, they behave as if
defined "my sub ..." --- which syntax is legal in Perl 6 (and I think in
sufficiently recent perl 5 if you specify a minimum version in your
script)). For a sub to be callable that way, it must explicitly be defined
as "our sub ...".

Although you will run into another issue because you have whitespace before
the "(", so it will be called with one parameter that is a 2-element list.
-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: stderr?

2017-09-13 Thread Brandon Allbery
On Wed, Sep 13, 2017 at 7:51 PM, ToddAndMargo  wrote:

> How do I print to STDERR?  $*ERR?
>
> $ perl6 -e 'print $*ERR, "print to std err\n";'
> print to std err
>
> What am I doing wrong?
>

Use the OO form: $*ERR.print: "print to std err\n";
Unlike Perl 5, there is no special syntactic form that takes a separate
handle.

Or use "note", which is "say" but to $*ERR.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Who called me?

2017-09-13 Thread Brandon Allbery
On Wed, Sep 13, 2017 at 7:56 PM, ToddAndMargo  wrote:

> I am trying to convert this from Perl 5:
>
> my $WhoCalledMe = ( caller(0) )[1];
>
> I use it inside a sub to determine who called the sub.
>
> How is this done in P6?
>

You want the callframe method. Note that it can be a bit more complex than
perl 5's caller because there are more things that act like call frames.
https://docs.perl6.org/routine/callframe (but most of the actual
documentation is at https://docs.perl6.org/type/CallFrame).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Who called me?

2017-09-13 Thread Brandon Allbery
On Wed, Sep 13, 2017 at 8:15 PM, ToddAndMargo  wrote:

> Would this be what I am looking for?
>
>
> for 1..* -> $level {
> given callframe($level) -> $frame {
> when $frame ~~ CallFrame {
> next unless $frame.code ~~ Routine;
> say $frame.code.package;
> last;
> }
> default {
> say "no calling routine or method found";
> last;
> }
> }
> }
>
> And I can't put it in a pm6 or I would get the next
> level down.
>

Presumably you'd just have to go up another level (or more since you also
get frames for blocks). I'm unclear if you need to check if the code block
produced is from a sub.

  pyanfar Z$ 6 'sub foo { my $x = callframe(0); dd $x.code.name }; sub bar
{ foo() }; bar()'
  "foo"
  pyanfar Z$ 6 'sub foo { my $x = callframe(1); dd $x.code.name }; sub bar
{ foo() }; bar()'
  "bar"
  pyanfar Z$ 6 'sub foo { my $x = callframe(2); dd $x.code.name }; sub bar
{ foo() }; bar()'
  ""

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: :: question

2017-09-13 Thread Brandon Allbery
On Thu, Sep 14, 2017 at 1:48 AM, Brandon Allbery <allber...@gmail.com>
wrote:

> If you want to use the other way, the CheckSystemDependency module MUST
> define Which as: our sub Which ...
> If it is not explicitly declared "our", then it is declared "my" and the
> only way the name can be seen outside the CheckSystemDependency module is
> for it to be exported and for your module to import it.
>
> You cannot simply call any sub you see in a different module. If it is not
> explicitly declared "our" then you cannot access it; it is declared locally
> to that module and cannot be seen anywhere else.
>

If this is still not clear, let's try an example:

  pyanfar Z$ 6 'module Foo { sub a { say "nope" }; our sub b { say "yep" }
}; Foo::b();'
  yep
  pyanfar Z$ 6 'module Foo { sub a { say "nope" }; our sub b { say "yep" }
}; Foo::a();'
  Could not find symbol ''
in block  at -e line 1


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: mtp???

2017-10-06 Thread Brandon Allbery
On Fri, Oct 6, 2017 at 6:13 PM, ToddAndMargo  wrote:

> The weird part is that Thunar sees and operates the thing perfectly!
>

Thunar has a lot fewer moving parts and uses libmtp directly. Krusader
likely relies on a lot of extra KDE IPC goop implementing a virtual
filesystem layer sitting between the mtp library and the file manager, that
might not be working well together for some reason, possibly version skew.
(Gnome and Mate also do that, and on my system neither mtp nor smb work
reliably through gnome-vfs.)

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: What is P6 for P5 `use Term::ReadKey`?

2017-09-09 Thread Brandon Allbery
On Sat, Sep 9, 2017 at 2:57 AM, ToddAndMargo  wrote:

> This guy maybe?
>
> https://github.com/krunen/term-termios/blob/master/README.md
>
> I can't tell what he is saying.
>
> And his example wont read a carriage return


That's very low level. And it's disabling icrnl, so a carriage return is
exactly that. \r not \n. (Same for output, it disables onlcr so \n moves
down a line without moving the cursor back to the left; you have to output
the \r yourself if you want it.)

There is no exact high level replacement for that perl 5 module *yet*.
There's work on a branch of https://github.com/ab5tract/terminal-print for
this, that I think hasn't been merged yet, much less released.

There is also a higher level gotcha: IIRC the read routine in rakudo wants
to read an extra character to make sure it's got a full Unicode character.
(Although arguably it should not in this case because there's an easy way
to know if you need another character or not.) But even then, probably for
single character input you want to set binary mode on $*IN.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: lats rakudo version from rakudobrew ?

2017-09-11 Thread Brandon Allbery
On Mon, Sep 11, 2017 at 3:40 PM, Marc Chantreux  wrote:

> it actually built stuff but at the end, perl6 -v still gives me 2017.05.
>

This is one of the gotchas of rakudobrew. It determines the version from
the most recent release tag... but it uses git in default fetch mode, which
only pulls the most recent tag and never updates it, so your updates will
have the right commit hash but the wrong version from that point on. I
typically do 'git fetch --all' (but 'git fetch --tags' is likely good
enough for your use) in the three repos under ~/.rakudobrew/git_reference.
(You only need to do it once; git will keep it up to date itself once it
has been told that you want to track that.)

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: user and group of a file?

2017-09-26 Thread Brandon Allbery
On Tue, Sep 26, 2017 at 11:02 AM, Parrot Raiser <1parr...@gmail.com> wrote:

> This is the capability provided by Perl 5's "stat". Would a clone with
> the same properties and behaviours be the right thing, or are there
> "features" to fix?


Same features, probably. It is just one of those things that is poorly
portable to Windows, so doesn't belong in the core. There should also be a
corresponding Windows module that matches Windows APIs instead of trying to
force it to look like Unix (which is what perl 5 does).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-25 Thread Brandon Allbery
On Mon, Sep 25, 2017 at 10:23 PM, ToddAndMargo <toddandma...@zoho.com>
wrote:

> On 09/25/2017 07:25 AM, Brandon Allbery wrote:
>
>> So as to make this not entirely content-free: I would suggest that the
>> string language note the line on which it sees a bare newline, and if it
>> subsequently hits a syntax error while still parsing that string it could
>> output something like perl 5's "Possible runaway multi-line string starting
>> on line ..." as a suggestion.
>>
>
> Really like this sugestion!
>

I'm actually looking at the code in question now... and unsure how to
proceed, as hacking on perl 6 parsers is a bit new to me and this looks
like it needs to be implemented in a way that is usable by multiple roles
representing different kinds of 'quoted string' (single, double, regex,
...).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-25 Thread Brandon Allbery
On Mon, Sep 25, 2017 at 10:49 PM, ToddAndMargo 
wrote:

> There is another operating system other than Linux?  I
> had heard rumors of that: it is slow, expensive, crashes
> all the time.  But I thought is was only a story to frighten
> little children and young programmers.   SAY IT ISN'T
> TRUE!!!   :-)
>

Please don't insult FreeBSD like that. :p

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-25 Thread Brandon Allbery
On Mon, Sep 25, 2017 at 3:09 AM, Julien Simonet 
wrote:

> I think your problem is coming from a (") missing at line 3.
> At the same line, the semicolon (;) is misplaced : it should be at the end
> if line.
>

It took older perl over a decade to come up with better error messages for
this. Can we please do it a bit sooner?

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-25 Thread Brandon Allbery
So as to make this not entirely content-free: I would suggest that the
string language note the line on which it sees a bare newline, and if it
subsequently hits a syntax error while still parsing that string it could
output something like perl 5's "Possible runaway multi-line string starting
on line ..." as a suggestion.

On Mon, Sep 25, 2017 at 10:19 AM, Brandon Allbery <allber...@gmail.com>
wrote:

> On Mon, Sep 25, 2017 at 3:09 AM, Julien Simonet <kernel.jul...@gmail.com>
> wrote:
>
>> I think your problem is coming from a (") missing at line 3.
>> At the same line, the semicolon (;) is misplaced : it should be at the
>> end if line.
>>
>
> It took older perl over a decade to come up with better error messages for
> this. Can we please do it a bit sooner?
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need a second pair of eyes

2017-09-26 Thread Brandon Allbery
This explanation confuses me a bit, actually. (more inline)

On Tue, Sep 26, 2017 at 9:45 AM, Larry Wall  wrote:

> In slightly greater detail, we're currently treating an undeclared
> variable as a syntax error rather than a semantic error, and we treat
> those differently.  Syntax errors are usually treated as immediately
> fatal becase they demonstrate we don't know what language we're parsing.
>

...because that was kinda the point. But with one additional piece of
metadata (when it last switched languages) and a small amount of domain
knowledge (that multiline in the current language is less common than
single-line) it can then suggest to the user that maybe there's a missing
end-switch.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: user and group of a file?

2017-09-26 Thread Brandon Allbery
On Tue, Sep 26, 2017 at 2:11 AM, ToddAndMargo  wrote:

> Does Perl 6 have one of those fancy subs that will tell me
> the user and group association of a file?  Or do I just
> make a system call to "ls"?
>

At the moment you'll have to use ls. There's an ecosystem want out for a
POSIX support module with this functionality; the core sticks to portable
operations, and user and group information is different on Windows
(notably: the ownership information is SIDs / UUIDs, and it's not so much
like Unix groups defined by its members as it is an ACL defined by logical
operations).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:09 AM, ToddAndMargo  wrote:

> Figured it out.  The chat line told me that there is an error in the
> docs.  The proper way was "e" not "f"
>

This is not the same thing. .e will return True if it exists but is a
directory, for example. I mentioned this in my first response.
In fact, the different behavior seems inconsistent and might be a bug.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Hash and subs question

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:05 AM, ToddAndMargo 
wrote:

> sub all-dimensions(% (:length(:$x), :width(:$y), :depth(:$z))) {
> $x andthen $y andthen $z andthen True
> }
>
> it turn my hash into single variables.  Is there a way to
> test if the right keys are present and keep my hash afterwards?
>

That's just one example. I would expect something like this to work:

sub foo(%bar (:length($)!, :width($)!)) {

which gives you the named one (instead of using the anonymous hash to
suppress it) and should test for requred keys while discarding their
(separated) values. Or you can use named variables instead f the $
placeholders if you actually want them.

Note, I am not sure what actually happens with the :$x etc. in the
original; it might be necessary to destructure those as ($ => $) or
something.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: how do I assign an array to a hash key

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:44 AM, ToddAndMargo 
wrote:

> I will probably use the @ for a while until I get use to
> it for readability.
>

I think that's actually disrecommended, because it looks too much like Perl
5's refs but isn't, so it can bite you unexpectedly if you treat it like
one.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: how do I assign an array to a hash key

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:32 AM, ToddAndMargo 
wrote:

> $ perl6 -e 'my %x = [aaa => "x", b=>@["y","q","r"], c=>"z"]; say %x; for
> @(%x) {say $_};'
> {aaa => x, b => [y q r], c => z}
> y
> q
> r
>
> This seems too easy.  I have to have done something wrong.
> What did I miss?
>

Only that it's even easier than you think: the @ was unnecessary when
building it. Perl 6 handles this kind of thing much better than Perl 5. And
there are other ways to spell the destructuring as well.

pyanfar Z$ 6 'my %x = [aaa => "x", b=>["y","q","r"], c=>"z"]; say %x;
for %x[*] {say $_};'
{aaa => x, b => [y q r], c => z}
y
q
r


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:06 AM, Brandon Allbery <allber...@gmail.com>
wrote:

> On Fri, Sep 29, 2017 at 12:59 AM, ToddAndMargo <toddandma...@zoho.com>
> wrote:
>
>> On 09/28/2017 09:53 PM, ToddAndMargo wrote:
>>
>>> On 09/28/2017 09:45 PM, Brandon Allbery wrote:
>>>
>>>> IO::Path's .f method. (Or .e to not require it to be a file, etc. as
>>>> usual.)
>>>>
>>>>  pyanfar Z$ 6 '".profile".IO.f.say'
>>>>  True
>>>>
>>>
>>> How do I get this to give me a "False" instead of crashing
>>> and wagging the finger at me?
>>>
>>> $ perl6 -e 'say "eraseme.txt".IO.f;'
>>> True
>>>
>>> $ perl6 -e 'say "erasxeme.txt".IO.f;'
>>> Failed to find '/home/linuxutil/erasxeme.txt' while trying to do '.f'
>>>in block  at -e line 1
>>>
>>
>> method f
>>
>> Defined as:
>>
>> method f(--> Bool:D)
>>
>> Returns True if the invocant is a path that exists and is
>> a file. The method will fail with X::IO::DoesNotExist if
>> the path points to a non-existent filesystem entity.
>>
>> maybe it is suppose to crash?
>
>
> This sounds broken, actually; I understand that a Failure treated as a
> Bool prevented it from throwing, so it should have simply returned False.
>
> Checking it for .defined *does* prevent throwing. Still seems like a bug.
>

Apparently not a bug, just unfortunate. You have to explicitly coerce it to
Bool to keep it from throwing.

pyanfar Z$ 6 '".profileX".IO.f.Bool.say'
False

(And, Norman? It produces a Failure, not a hard exception. You can
introspect Failures to keep them from getting thrown.)

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:59 AM, ToddAndMargo <toddandma...@zoho.com>
wrote:

> On 09/28/2017 09:53 PM, ToddAndMargo wrote:
>
>> On 09/28/2017 09:45 PM, Brandon Allbery wrote:
>>
>>> IO::Path's .f method. (Or .e to not require it to be a file, etc. as
>>> usual.)
>>>
>>>  pyanfar Z$ 6 '".profile".IO.f.say'
>>>  True
>>>
>>
>> How do I get this to give me a "False" instead of crashing
>> and wagging the finger at me?
>>
>> $ perl6 -e 'say "eraseme.txt".IO.f;'
>> True
>>
>> $ perl6 -e 'say "erasxeme.txt".IO.f;'
>> Failed to find '/home/linuxutil/erasxeme.txt' while trying to do '.f'
>>in block  at -e line 1
>>
>
> method f
>
> Defined as:
>
> method f(--> Bool:D)
>
> Returns True if the invocant is a path that exists and is
> a file. The method will fail with X::IO::DoesNotExist if
> the path points to a non-existent filesystem entity.
>
> maybe it is suppose to crash?


This sounds broken, actually; I understand that a Failure treated as a Bool
prevented it from throwing, so it should have simply returned False.

Checking it for .defined *does* prevent throwing. Still seems like a bug.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:10 AM, Brandon Allbery <allber...@gmail.com>
wrote:

> Apparently not a bug, just unfortunate. You have to explicitly coerce it
> to Bool to keep it from throwing.
>
> pyanfar Z$ 6 '".profileX".IO.f.Bool.say'
> False
>

This can also be done with 'so' or prefix '?'.

pyanfar Z$ 6 'say ?".profileX".IO.f'
False

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: -f ???

2017-09-28 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 12:41 AM, ToddAndMargo 
wrote:

> Does perl 6 have an equivalent to bash's "-f" to
> see if a file exists?  Or is that a system call?
>

IO::Path's .f method. (Or .e to not require it to be a file, etc. as usual.)

pyanfar Z$ 6 '".profile".IO.f.say'
True

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Tip: assign a value to a hash using a variable as a key

2017-09-30 Thread Brandon Allbery
On Sat, Sep 30, 2017 at 7:44 PM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 09/30/2017 02:15 PM, Brandon Allbery wrote:
>
>> This concept gets reused enough that it's not separately described for
>> every place where it is used; the documentation would be impossible to
>> manage, almost as impossible to read, and often out of sync with itself if
>> every reused concept had to be fully explained everywhere it is used.
>>
>
> In this lies the problem I have with a lot of documentation.
> It is often written as a refresher for those who already
> familiar with the concepts.  Linux "man pages" are notorious
> for this.
>

There should have been a link to the section on quoting forms. Although,
last time I looked at that, it was a bit dense.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Any way to get hashes to loop in order?

2017-09-29 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 9:55 PM, ToddAndMargo  wrote:

> for %SmtpIni.kv -> $key, $value { say $key; }
>
> Does "say" the keys in the order that I created them.
>
> Is there a way to get them to do so?
>

Not without storing that order somewhere yourself and using it to retrieve
values. The point of a hash is that it computes hash values from its keys
for fast lookup, and to the extent that any order can be said to exist for
keys in a hash, it will be related somehow to those hash values. As a
practical matter, Hashes are not considered to have any ordering.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Tip: assign a value to a hash using a variable as a key

2017-09-30 Thread Brandon Allbery
On Sat, Sep 30, 2017 at 10:30 PM, ToddAndMargo <toddandma...@zoho.com>
wrote:

> On 09/30/2017 02:15 PM, Brandon Allbery wrote:
>
>> Basically: < > is single quotes and treats variables and expressions as
>> literals. << >> is double quotes and interpolates variables but not general
>> expressions. And { } does no quoting at all and uses general expressions.
>
>
This gets a little complex...


> 1) expressions
>
> 2) the difference between "expressions" and "general expressions"
>

Doublequoted strings don't just expand variables. Postfixes (like [] or <>
to look up values in arrays/hashes) are also understood; method calls on
variables also work, as long as they end with a parenthesized expression
(so, "hi $foo.name" will not work (it'll expand '$foo' instead of '$foo.name')
but "hi $foo.name()" will, provided $foo contains an object with a 'name'
method). This is what I meant by 'expression', which I should have probably
called 'simple expression' or something.


> 3) Quoting.  The difference between "" and <>
>

' ' strings and <> postfixes are almost identical. %foo is the same as
%foo{'a'}. But %foo acts like you did: %foo{'a'}, %foo{'b'}
" " strings and << >> postfixes are almost identical. %foo<> is the same
as %foo{"a"}. But %foo<> acts like you did: %foo{"a"}, %foo{"b"}

Inside ' ' strings, everything is literal.
Inside " " strings, variables like $foo and (simple) expressions (described
above) will be replaced by their values; and you can use { } to insert the
result of any expression. (This also works in << >>.)

pyanfar Z$ 6 'my %x = ("a"=>"b","c"=>"d", "e"=>"f"); my $v = "b"; say
%x<>'
(b d)

4) "interpolating" as it refers to Perl (not math, where you "guess"
> what a value is based on values on both sides of you).
>

Replacing something inside a string with the string representation of its
value. This sense is also used in documentation for the shell, where you
can also interpolate `` subcommand output and such.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:01 AM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 09/30/2017 07:59 PM, Brandon Allbery wrote:
>
>> Inside " " strings, variables like $foo and (simple) expressions
>> (described above) will be replaced by their values; and you can use { } to
>> insert the result of any expression. (This also works in << >>.)
>>
>>  pyanfar Z$ 6 'my %x = ("a"=>"b","c"=>"d", "e"=>"f"); my $v = "b";
>> say %x<>'
>>  (b d)
>>
> What does the ".succ" do?
>

In this case it's just an example of an expression that wouldn't have
worked by normal interpolation (although $v.succ() would have, as I
described earlier).

succ is short for "successor"; think of it as the generalized version of
adding 1 to something. In Perl 6, it can be used (but ideally shouldn't) on
numbers, or to get the next element of an Enum (note that this might not
necessarily correspond to its numeric value plus one), or as in this case
to get the next notional "value" of a string: this is a somewhat
rationalized version of Perl 5's "magic autoincrement" and is described at
https://docs.perl6.org/type/Str#method_succ . It's useful, especially in
the form of the ++ autoincrement operator, for autogenerating filenames.

pyanfar Z$ 6 'my $x = "file1.txt"; say $x.succ'
file2.txt

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:01 AM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 09/30/2017 07:59 PM, Brandon Allbery wrote:
>
>> parenthesized expression (so, "hi $foo.name <http://foo.name>" will not
>> work (it'll expand '$foo' instead of '$foo.name <http://foo.name>') but
>> "hi $foo.name <http://foo.name>()" will, provided $foo
>
>
Urgh. This (getting links added to something that looks like a hostname)
seems to be a new gmail-ism. I didn't see it until my self-copy arrived.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 1:02 PM, yary  wrote:
>
> I hadn't heard of TWEAK, thought that BUILD was for setting private
> attributes and other tasks the object runs to build itself.
>

IIRC having BUILD overrides default values, so if you want to have those
and still adjust things at object initialization time then you need to use
TWEAK.
(But I can't help but think that this means some things still haven't been
quite worked out yet. Although --- I didn't look, but maybe that's what the
recent changes to BUILDALL etc. were about?)

(It occurs to me that BUILD might be a multi, with an autogenerated one
that sets the default values and then 'nextsame's or similar?)

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Tip: assign a value to a hash using a variable as a key

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:32 AM, Richard Hainsworth 
wrote:

> 
>
>> Is English your first Language?  I asked this because of your use
>>>
>> of the word "interpolate", which you used correctly.
>>
> This is an odd question and comes across as prejudiced. If someone uses a
> word correctly, then how does this lead to an aspersion it is the user's
> second language? Further Brandon has been extremely patient and forthcoming
> in his answers to your questions, so asking a question like this is a bit
> insulting.
>
> Remember also that Larry Wall - perl's "inventor" - is a linguist, and the
> use of language in perl6 space in particular reflects that.
>

It's also missing the point that I might be using a term with an
established meaning in context: as I mentioned previously, "interpolate" in
this meaning has been used for many years by both Perl and shells (and in
fact comes from even earlier uses.) This says nothing about my language,
only *possibly* about the language and/or background of those who
established the usage.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 4:56 PM, Timo Paulssen  wrote:

> *method new* is useful only if you want to take positional parameters for
> the .new — the default new you get from *Mu* only accepts named arguments
> and passes them on as-is to *self.bless*. They then get passed to every
> *BUILD* and *TWEAK* in the inheritance chain. The named parameters don't
> have to correspond to attribute names, as you can do any private attribute
> assignment in *TWEAK* that you like.
>
And adding, just in case it isn't clear: the problem with positional
parameters to method new is there is no sane way to inherit them from
superclasses or make them usable from subclasses without baking them into
the entire object hierarchy. They make sense only for things like what Java
calls final classes, and even then probably only for atomic value types
(e.g. things like Int where the value is a single 'thing' and wholly
defines the identity of an instance).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need append help

2017-09-29 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 1:49 PM, ToddAndMargo  wrote:

> I am trying to find a shorter way of doing
>  $x = $x ~ "def"
>
> But I can't seem to master "append"
>
> What am I doing wrong?
>

Again (as with last night in IRC) you are treating a string as a list. But
a string is a single thing; it doesn't make sense to list-append to it.

$x ~= "def";

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: -f ???

2017-09-29 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 9:53 AM, Parrot Raiser <1parr...@gmail.com> wrote:

> Discussing the full implications of these tests could probably keep a
> philosophy class busy for an afternnon. It might even rise to an
> LPU[1] paper.
>

It's even more involved than you think; I have notes for what could
potentially be an "interesting" LTA bug report that could possibly turn
into three and have implications beyond file tests.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need append help

2017-09-29 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 2:04 PM, ToddAndMargo  wrote:

> $ perl6 -e 'my $x="abc"; $x ~= "def"; say $x;'
> abcdef
>
> Perfect!  Thank you!
>
> I am slowly getting away from my Modula 2 "Array of Characters" days.
>
> Question:  Is thee a pretty way like the above to do a prepend?
>

No, sorry. The downside of this is that it's easy to string-append but hard
to string-prepend without having to move stuff around in memory. (The
future may have string-aggregate types, commonly known as "ropes", which
would make this easier.)

As for "array of characters", this quickly turns into a problem --- and
languages that take the 'array of characters' approach are still struggling
with it.

Quick: how many 'characters' is "ň"?

Turns out the answer is: one grapheme OR two Unicode codepoints (Latin
letter lowercase n, combining caron) OR 3 bytes in UTF-8 encoding (2 bytes
for the combining caron). (Among others. Java sees two codepoints in UTF-16
encoding, for 4 bytes. C wants a trailing NUL character, also adding a 4th
byte.) And which one is the correct way to look at it depends on what you
are doing with it.

(This may not matter much to you if you only ever deal with basic Latin-1
like the US uses. But for the past several days I've had to deal with the
names of sports teams from various European countries, with things like ň
and ğ and ş in them --- and that's ignoring the names in Cyrillic or Hebrew
characters. The U.S. is not the whole world. And it's helpful when the
language doesn't force me to jump through weird hoops to deal with them.)

A string can't simultaneously be three different lists. So it ends up being
one thing, and we provide ways to decompose it into the various other
forms. But if you are just thinking of strings of text, we don't make you
think about that; we provide specific string operations instead of making
you figure out which way to decompose it and add the new part and recompose
it. The string operations operate at grapheme level, because when you are
thinking of it as text, that's usually what you intend: you see one
'character' (grapheme) there, not the two codepoints or the 3 bytes or
whatever --- but they have to be clever, because what if you are appending
another combining character?

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need append help

2017-09-29 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 2:32 PM, Sean McAfee <eef...@gmail.com> wrote:

> On Fri, Sep 29, 2017 at 11:27 AM, Brandon Allbery <allber...@gmail.com>
> wrote:
>
>> On Fri, Sep 29, 2017 at 2:04 PM, ToddAndMargo <toddandma...@zoho.com>
>> wrote:
>>
>>>
>>> Question:  Is thee a pretty way like the above to do a prepend?
>>>
>>
>> No, sorry.
>>
>
> Actually, there seems to be:
>
> > my $x = "abc"
> abc
> > $x [R~]= "xyz"
> xyzabc
> > $x
> xyzabc
>

Suppose that depends on your definition of "pretty". I find that use of R
metaop more obfuscatory than pretty,

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need append help

2017-09-29 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 3:27 PM, ToddAndMargo  wrote:

> I do not understand.  :'(
>

There's not enough syntax to go around, so perl 6 has to use spaces
sometimes to figure out what you want.


> $ perl6 -e 'my $x="abc"; $x[R~]= "yyz"; say $x;'
> ===SORRY!=== Error while compiling -e
> Missing required term after infix
>

I explained this one earlier. Things would go faster if you read entire
messages.

The sequece `$x[` could potentially mean that $x is an array stored in a
scalar variable, and you are asking for a particular item from the array.
Or it could mean the start of a complex operator to be applied to $x. You
need a space to tell it which you intend: without the space it sees the
indexing operation, without it sees the complex operator.

In this case, the complex operator is composed of a basic operator '~'
(string concatenation), modified twice: once with the reversing
metaoperator (Rop), and a second time with the in-place assigment operator
(postfix =). Just as you need to use parentheses in `2 + 3 * 5` if you want
it to be (2 + 3) * 5 instead of 2 + (3 * 5), you need braces to tell it how
to combine these special operators --- and you must *not* have a space
before the postfix =. Which is why you got this error:


> $ perl6 -e 'my $x="abc"; $x [R~] = "yyz"; say $x;'
> ===SORRY!=== Error while compiling -e
> Preceding context expects a term, but found infix = instead


With the space before it, it is no longer a modifier for the reversed
concatenation [R~] but a standalone assignment operator, which can't happen
there because it already has an operator [R~] so now it needs to see a term
(expression, roughly).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need append help

2017-09-29 Thread Brandon Allbery
On Fri, Sep 29, 2017 at 3:36 PM, ToddAndMargo  wrote:

> This is the correct one. The warning about "useless use" here is a bug
>> in rakudo. It's meant to warn for things like
>>
> Another bug.  Lucky me, again.   :'(
>
> Thank you!
>

Also, this is about the third time in the past 2 days that I pointed out
something like this to you, then you hit it later and it was somehow
something you had never seen before.
Perhaps I should stop trying to explain things, since you aren't actually
reading?

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: chown?

2017-09-28 Thread Brandon Allbery
On Thu, Sep 28, 2017 at 11:15 PM, ToddAndMargo 
wrote:

> I wonder why they did not "banish" (sound so harsh) chmod?
>

Basic file permissions are actually relatively similar. Windows (and OS X!
see chmod(1)) integrate ACL support, but there's still a reasonably common
core that doesn't run into key differences. ACL support is what goes into
the ecosystem, as a result.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Hash and subs question

2017-09-28 Thread Brandon Allbery
On Thu, Sep 28, 2017 at 11:52 PM, ToddAndMargo 
wrote:

> I see that SayHash(%H) will take any hash I send it.
>
> Is there a way to make the compiler pissed if a sub does not see
> the specific keys int he hash it wants?  Or do I need to use loop
> with ":exists" and test each key?
>

You should be able to use a destructuring signature (
https://docs.perl6.org/type/Signature#index-entry-destructuring_arguments_%28Signature%29
)

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: overwrite?

2017-09-24 Thread Brandon Allbery
On Mon, Sep 25, 2017 at 1:41 AM, ToddAndMargo  wrote:

> I suppose I should say at this point that the purpose of the file
> is to be a single line with the date the program was last run
> in it.  If the current date's month and the month in the file
> differ, it triggers an event in my program.


Had you considered using the file last-modified timestamp instead?

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: thread behavior

2017-09-04 Thread Brandon Allbery
On Mon, Sep 4, 2017 at 6:18 AM, Elizabeth Mattijsen  wrote:

> That can not be relied on in general, I’m afraid.  However, after some
> discussion, it appears that there is some support for an
> "is-initial-thread” method:
>
>https://irclog.perlgeek.de/perl6-dev/2017-09-04#i_15112552
>
> Note that the feeling is that you shouldn’t write code that depends on
> this.
>

NativeCall users are likely to have a need for code that is guaranteed to
execute on the initial OS thread, and for specific C calls to always be
made on the same OS thread (both of these are related to thread-local
state; the former is often but not always such state initialized by
something not under the caller's control in the initial thread, often by a
shared object).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: who own my code?

2017-10-23 Thread Brandon Allbery
On Mon, Oct 23, 2017 at 1:47 AM, Jan Ingvoldstad <frett...@gmail.com> wrote:

> On Sun, Oct 22, 2017 at 10:32 PM, Brandon Allbery <allber...@gmail.com>
> wrote:
> > This is still best discussed elsewhere... isn't there a stackexchange for
> > this kind of stuff?
>
> Ah, Stack Exchange, the quality site where the _first_ answer is the
> most significant.
>

Sometimes, but not always. Remember that the default for answered questions
is reverse by rating, so the topmost answer will be the higest rated one;
you can change the sort order, and occasionally can observe it in an
intermediate state before it re-sorts the (cached?) page. As such it's no
worse than any other crowdsourced site/resource (including pre-Internet
ones like Consumer Reports or the U.S.'s Better Business Bureau).

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Anyone want me eMail and download interface for curl?

2017-11-04 Thread Brandon Allbery
On Fri, Nov 3, 2017 at 5:41 PM, ToddAndMargo  wrote:

> I frequently post modules I have come up with.  Should
> I stop the practice?
>

In countries signatory to the Berne Convention on Copyright, the default
copyright is problematic; you should be explicit about the license on any
code you release. (Arguably this includes even small snippets; not everyone
has a fair-use exemption.)

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Self invoked anonymous functions with no outer scoped ???

2017-12-08 Thread Brandon Allbery
That might prove difficult considering how much of the language is
*defined* in outer scopes. (Including, er, the basic grammar.)

On Fri, Dec 8, 2017 at 3:25 PM, Andy Bach  wrote:

> I ran into this article
> https://medium.com/@kasperpeulen/an-interesting-
> programming-feature-that-no-language-has-except-php-4de22f9e3964
>
> The feature allows [you] to write *self invoked anonymous functions that
> don’t let any scope from the outer function leak in*. The syntax he
> proposes involves the *use* keyword, followed by explicit parameters,
> which is followed by a block that can use those parameters and return a
> value.
>
> But I don't quite (er, okay, at all) understand what the point is.  Just
> curious if P6 has anything along this sort thing.
>
> --
>
> a
>
> Andy Bach,
> afb...@gmail.com
> 608 658-1890 <(608)%20658-1890> cell
> 608 261-5738 <(608)%20261-5738> wk
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: who own my code?

2017-10-21 Thread Brandon Allbery
On Sat, Oct 21, 2017 at 5:56 AM, ToddAndMargo  wrote:

> On Sat, Oct 21, 2017 at 12:57 AM, ToddAndMargo >> > wrote:
>>> On 10/21/2017 12:40 AM, ToddAndMargo wrote:
>>>
>>> If I write a program for a customer who pays my labor to
>>> write it, who own the program?  Me or the customer?
>>>
>>>
>>> I am a private contractor.  What they payed me for fixing a/the
>>> problem.  They don't care how.  I was wondering if they owned
>>> any of the code I wrote to fix the problem.  The customer did
>>> not specifically ask me to write anything.
>>>
>>>
> On 10/21/2017 01:07 AM, Brent Laabs wrote:
>
>> This depends on the contract you signed with the customer, and laws in
>> your local jurisdiction.  As such, it's probably a question more
>> appropriate to ask a lawyer than this list.
>>
>>
> There is no contract involved.  The customer wants a problem fixed.
> He does not want to know how.  And he is not commissioning me for
> any software.  Just a fix.
>

My working assumption in this case is that for fixing/patching existing
software, any code is subject to the original copyright and ownership;
because I am working as an agent for the customer, new stuff is owned by
the customer unless specified otherwise.

BUT.

If this situation comes up, you need to be talking to the *customer* about
it. It doesn't necessarily need to be a formal contract, but the final
decision should be in writing and you and the customer should both have
signed copies of it in case questions come up in the future.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: I need `dir` help

2018-05-10 Thread Brandon Allbery
On Thu, May 10, 2018 at 7:34 PM, ToddAndMargo  wrote:

> https://docs.perl6.org/routine/dir
>
> perl6 -e 'my $x=dir; say "$x";'
>
> Does indeed read the directory, but give me one YUGE string.
> I need each entry to have some kind of a separator.
>

I'd say you did that to yourself, by wrapping it in quotes thereby forcing
it to turn into a simple single string. $x itself is a Seq of IO::Path
objects.

It will be easier to track this if you capture into an array (@x instead of
$x) and iterate over the contents. Or iterate directly:

pyanfar Z$ 6 'for dir() -> $x { say "$x" }'
debian-8.2.0-amd64-lxde-CD-1.iso
lb.txt
screenshotF-20161029T192446.png
haskell-report-1.4.ps.gz
hkcart.jpg
(...)

I'm quoting $x there for the same reason, to turn the IO::Path into a Str.
Although arguably the correct way to do that is $x.Str instead of "$x".

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: I need `dir` help

2018-05-10 Thread Brandon Allbery
On Thu, May 10, 2018 at 7:49 PM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 05/10/2018 04:43 PM, Brandon Allbery wrote:
>
>> On Thu, May 10, 2018 at 7:34 PM, ToddAndMargo <toddandma...@zoho.com
>> <mailto:toddandma...@zoho.com>> wrote:
>> It will be easier to track this if you capture into an array (@x instead
>> of $x) and iterate over the contents. Or iterate directly:
>>
>> pyanfar Z$ 6 'for dir() -> $x { say "$x" }'
>> debian-8.2.0-amd64-lxde-CD-1.iso
>> lb.txt
>> screenshotF-20161029T192446.png
>> haskell-report-1.4.ps.gz
>> hkcart.jpg
>> (...)
>>
>> I'm quoting $x there for the same reason, to turn the IO::Path into a
>> Str. Although arguably the correct way to do that is $x.Str instead of "$x".
>>
>
> I get a bunch of quotes and .IO's
>

The last line of my message, quoted above, is there for a reason. An
IO::Path is not a Str.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: I need `dir` help

2018-05-10 Thread Brandon Allbery
I think you'll need to provide a better explanation of what you're trying
to accomplish. I can think of lots of ways to do useful things with the
output of dir(), but have no idea which one(s) you need.

On Thu, May 10, 2018 at 7:52 PM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 05/10/2018 04:49 PM, ToddAndMargo wrote:
>
>> On 05/10/2018 04:43 PM, Brandon Allbery wrote:
>>
>>> On Thu, May 10, 2018 at 7:34 PM, ToddAndMargo <toddandma...@zoho.com
>>> <mailto:toddandma...@zoho.com>> wrote:
>>>
>>> https://docs.perl6.org/routine/dir <https://docs.perl6.org/routin
>>> e/dir>
>>>
>>> perl6 -e 'my $x=dir; say "$x";'
>>>
>>> Does indeed read the directory, but give me one YUGE string.
>>> I need each entry to have some kind of a separator.
>>>
>>>
>>> I'd say you did that to yourself, by wrapping it in quotes thereby
>>> forcing it to turn into a simple single string. $x itself is a Seq of
>>> IO::Path objects.
>>>
>>> It will be easier to track this if you capture into an array (@x instead
>>> of $x) and iterate over the contents. Or iterate directly:
>>>
>>> pyanfar Z$ 6 'for dir() -> $x { say "$x" }'
>>> debian-8.2.0-amd64-lxde-CD-1.iso
>>> lb.txt
>>> screenshotF-20161029T192446.png
>>> haskell-report-1.4.ps.gz
>>> hkcart.jpg
>>> (...)
>>>
>>> I'm quoting $x there for the same reason, to turn the IO::Path into a
>>> Str. Although arguably the correct way to do that is $x.Str instead of "$x".
>>>
>>
>> I get a bunch of quotes and .IO's
>>
>> :'(
>>
>>
>>
>> $ perl6 -e 'for dir() -> $x { say $x };'
>> "eraseme.pl6".IO
>> "crashme.pl6".IO
>> "DisableCaplock".IO
>> "OpenSmartSuite".IO
>>
>
>
> using "$x" removes the quotes and .IO, but I need to test each
> line without the quotes and .IO's
>
>
>
>
> --
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: I need indir help

2018-05-10 Thread Brandon Allbery
Testing whether a file exists is smartmatching an IO::Path (or a Str that
gets coerced to one) against :e.

"indir" is not "is this file in this directory?", it's "run this code in
this directory instead of where I am now". So it's complaining that you
didn't tell it what code to run there.

On Thu, May 10, 2018 at 8:04 PM, ToddAndMargo  wrote:

> Hi All,
>
> I am over on
> https://docs.perl6.org/routine/indir
>
> I can make heads of tails out of what is going on.
>
> I want to check is a file exists.
>
>
> $ perl6 -e 'say indir("./EchoTest");'
> ===SORRY!=== Error while compiling -e
> Calling indir(Str) will never work with any of these multi signatures:
> ($path, , :$test!)
> ($path, , :$d = Bool::True, :$r, :$w, :$x)
> at -e:1
>
>
> Many thanks,
> -T
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: I need regex help

2018-05-10 Thread Brandon Allbery
Pretty much what it's telling you. Instead of the numbers in braces, it's
the ** operator with a range after it: \d ** 1..4
(Remember that spaces do nothing in a P6 regex, so you can use them for
readability or to separate the range from what follows, etc.)

On Thu, May 10, 2018 at 11:56 PM, ToddAndMargo 
wrote:

> Hi All,
>
> I am trying to convert this over from Perl5:
>
> P5:
> $dir_entry  =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;
>
> P6:
> $dir_entry  ~~ m/.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*{$Extension}/;
>
>
> $ perl6 -c GetUpdates.pl6
> ===SORRY!===
> Unsupported use of {N,M} as general quantifier; in Perl 6 please use **
> N..M (or ** N..*)
> at /home/linuxutil/GetUpdates.pl6:425
> --> $dir_entry  ~~ m/.*?(\d{1,4}⏏\D\d{1,4}\D\d{1,4
> }).*{$Extension}/;
>
>
> What am I doing wrong?
>
>
> Many thanks,
> -T
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Need match character help

2018-05-16 Thread Brandon Allbery
You need to be more careful with regexes (any regexes). Your character
class matches if any character in the string matches, so 'd' satisfies it
and the rest of the string is ignored. If you want to ensure *no* character
matches, then say so:

pyanfar Z$ 6 'if "dgm" ~~ /^<[d..z]-[gm]>*$/ {say "y"} else {say "n"}'
n


On Wed, May 16, 2018 at 9:05 PM, Todd Chester  wrote:

>
>
> On 05/16/2018 07:58 AM, Timo Paulssen wrote:
>
>> On 16/05/18 00:10, ToddAndMargo wrote:
>>
>>> What would the syntax be for d..z, but not g or m?
>>>
>>
>> You can subtract [gm] from [d..z] like this:
>>
>>  say "c" ~~ /<[d..z]-[gm]>/;
>>  say "d" ~~ /<[d..z]-[gm]>/;
>>  say "f" ~~ /<[d..z]-[gm]>/;
>>  say "g" ~~ /<[d..z]-[gm]>/;
>>
>>
> Something is wrong:
>
> $ p6 'if "dgm" ~~ /<[d..z]-[gm]>/ {say "yes"}else{say "no"};'
> yes
>
> I want it to fail if it find g or m
>
> :'(
>
>
> $ alias p6
> alias p6='perl6 -e'
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need sort help

2018-06-09 Thread Brandon Allbery
The ".=" operator means call the method on the right, with the thing on the
left as invocant, and assign the result back to the thing on the left. So

@x .= sort: ...

is the same as

@x = @x.sort(...)

So you're being confused by the syntactic "magic" of ".=".

On Sat, Jun 9, 2018 at 2:58 PM Xin Cheng  wrote:

> I got the point for //.
>
> Another question is about calling the method sort with a code block. I can
> understand
>
> @x .= sort({ ... });
>
> But I don't quite understand why this form also works.
>
> @x .= sort: { ... };
>
> I look into the documentation for infix ":",
> https://docs.perl6.org/routine/: , and it explains something like this:
>
> Used as an argument separator just like infix , and marks the argument to
> its left as the invocant. That turns what would otherwise be a function
> call into a method call.
>
> substr('abc': 1);   # same as 'abc'.substr(1)
> Infix : is only allowed after the first argument of a non-method call. In
> other positions, it's a syntax error.
>
>
> How does the above explanation related to the case in hand @x .= sort: {
> ... }; ? Is sort an invocant? Or I miss something.
>
> Regards
>
> Xin
>
>
>
> On Jun 9, 2018, at 12:44 PM, Brandon Allbery  wrote:
>
> More precisely, at that point you have a bunch of numbers, but possibly
> not as many as expected if some of the components weren't numeric (or all
> of them, as when there are files present that aren't the expected logs).
> Which means some or all of those variables will be undefined instead of
> numbers. The // replaces those with the following value (0), so they do
> something sensible when sorted instead of producing warnings.
>
> On Sat, Jun 9, 2018 at 11:40 AM Xin Cheng  wrote:
>
>> This is very interesting. But I wonder how it works. I can understand the
>> first line
>>
>>  my ($month, $day, $year, $hour, $minute, $second) = .comb(/\d+/);
>>
>> Which extract the variables from $_. What is the second line doing, it is
>> very concise.
>>
>>  ($year // 0, $month // 0, $day // 0, $hour // 0, $minute // 0,
>> $second // 0, $_);
>>
>> Could somebody explain in some more words.? What does  // do? Why it
>> sorts the array?
>>
>> Regards
>>
>> Xin
>>
>> On Jun 9, 2018, at 12:51 AM, Timo Paulssen  wrote:
>>
>> That's unnecessarily long and complicated, here's how you can do it much
>> easier:
>>
>> @x.sort: {
>> my ($month, $day, $year, $hour, $minute, $second) = .comb(/\d+/);
>> ($year // 0, $month // 0, $day // 0, $hour // 0, $minute // 0,
>> $second // 0, $_);
>> }
>>
>> Trying it on some input data:
>>
>> cimtrak.log.06-08-2018_16:07:39.zip
>> cimtrak.log.06-08-2018_17:07:39.zip
>> cimtrak.log.07-08-2018_06:07:39.zip
>> cimtrak.log.07-08-2018_16:07:39.zip
>> cimtrak.log.12-08-2016_06:07:39.zip
>> cookies
>> asbestos
>> fire engine
>> perl6
>> butterflies
>>
>> results in:
>>
>> asbestos
>> butterflies
>> cookies
>> fire engine
>> perl6
>> cimtrak.log.12-08-2016_06:07:39.zip
>> cimtrak.log.06-08-2018_16:07:39.zip
>> cimtrak.log.06-08-2018_17:07:39.zip
>> cimtrak.log.07-08-2018_06:07:39.zip
>> cimtrak.log.07-08-2018_16:07:39.zip
>>
>> This is the schwartzian transform that was mentioned in another mail.
>> why it wasn't actually shown, i have no clue :)
>>
>> Hope that helps
>>   - Timo
>>
>>
>>
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
>
>

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need sort help

2018-06-09 Thread Brandon Allbery
More precisely, at that point you have a bunch of numbers, but possibly not
as many as expected if some of the components weren't numeric (or all of
them, as when there are files present that aren't the expected logs). Which
means some or all of those variables will be undefined instead of numbers.
The // replaces those with the following value (0), so they do something
sensible when sorted instead of producing warnings.

On Sat, Jun 9, 2018 at 11:40 AM Xin Cheng  wrote:

> This is very interesting. But I wonder how it works. I can understand the
> first line
>
>  my ($month, $day, $year, $hour, $minute, $second) = .comb(/\d+/);
>
> Which extract the variables from $_. What is the second line doing, it is
> very concise.
>
>  ($year // 0, $month // 0, $day // 0, $hour // 0, $minute // 0,
> $second // 0, $_);
>
> Could somebody explain in some more words.? What does  // do? Why it sorts
> the array?
>
> Regards
>
> Xin
>
> On Jun 9, 2018, at 12:51 AM, Timo Paulssen  wrote:
>
> That's unnecessarily long and complicated, here's how you can do it much
> easier:
>
> @x.sort: {
> my ($month, $day, $year, $hour, $minute, $second) = .comb(/\d+/);
> ($year // 0, $month // 0, $day // 0, $hour // 0, $minute // 0,
> $second // 0, $_);
> }
>
> Trying it on some input data:
>
> cimtrak.log.06-08-2018_16:07:39.zip
> cimtrak.log.06-08-2018_17:07:39.zip
> cimtrak.log.07-08-2018_06:07:39.zip
> cimtrak.log.07-08-2018_16:07:39.zip
> cimtrak.log.12-08-2016_06:07:39.zip
> cookies
> asbestos
> fire engine
> perl6
> butterflies
>
> results in:
>
> asbestos
> butterflies
> cookies
> fire engine
> perl6
> cimtrak.log.12-08-2016_06:07:39.zip
> cimtrak.log.06-08-2018_16:07:39.zip
> cimtrak.log.06-08-2018_17:07:39.zip
> cimtrak.log.07-08-2018_06:07:39.zip
> cimtrak.log.07-08-2018_16:07:39.zip
>
> This is the schwartzian transform that was mentioned in another mail.
> why it wasn't actually shown, i have no clue :)
>
> Hope that helps
>   - Timo
>
>
>

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need sort help

2018-06-09 Thread Brandon Allbery
And in the others, you've provided an explicit invocant with ".sort", so again it knows it's a method call and has an invocant
already.

A sub can be forced to be a method call instead by using ":" and providing
the invocant *before* the colon:  say sort(<3 5 2 1>: {$^a <=> $^b})

On Sat, Jun 9, 2018 at 4:05 PM Brandon Allbery  wrote:

> The colon only works on a method call. In "say sort:" it's not used as a
> method, it's used as a sub; the colon causes it to try to reinterpret as a
> method call, then it can't find an invocant for the method to operate on.
>
> In "@x .= sort:", the ".=" forces a method call with @x as invocant; then
> "sort:" has an invocant to work with.
>
> On Sat, Jun 9, 2018 at 4:02 PM Xin Cheng  wrote:
>
>> Thanks. But I am actually confused by the use of colon in
>>
>> Sort: { ... }
>>
>> What does it mean in the above statement? I have done several experiments
>> like:
>>
>> p6 'say sort({$^a <=> $^b}, < 3 5 2 1>)'# (1 2 3 5)
>>
>> p6 'say <3 5 2 1>.sort({$^a <=> $^b})' # it works.
>>
>> p6 'say <3 5 2 1>.sort: {$^a <=> $^b}'  # it works.
>>
>> But I don't know what the colon here mean, although I know it works.
>>
>> If I write something like this,
>>
>> p6 'say sort: {$^a <=> $^b} < 3 5 2 1> '  # It doesn't work.
>>
>> But why? Why the colon works in one form, but not in another form? So I
>> want to know the meaning of the colon when it works.
>>
>> Regards
>>
>> Xin
>>
>> On Jun 9, 2018, at 3:01 PM, Brandon Allbery  wrote:
>>
>> The ".=" operator means call the method on the right, with the thing on
>> the left as invocant, and assign the result back to the thing on the left.
>> So
>>
>> @x .= sort: ...
>>
>> is the same as
>>
>> @x = @x.sort(...)
>>
>> So you're being confused by the syntactic "magic" of ".=".
>>
>> On Sat, Jun 9, 2018 at 2:58 PM Xin Cheng  wrote:
>>
>>> I got the point for //.
>>>
>>> Another question is about calling the method sort with a code block. I
>>> can understand
>>>
>>> @x .= sort({ ... });
>>>
>>> But I don't quite understand why this form also works.
>>>
>>> @x .= sort: { ... };
>>>
>>> I look into the documentation for infix ":",
>>> https://docs.perl6.org/routine/: , and it explains something like this:
>>>
>>> Used as an argument separator just like infix , and marks the argument
>>> to its left as the invocant. That turns what would otherwise be a function
>>> call into a method call.
>>>
>>> substr('abc': 1);   # same as 'abc'.substr(1)
>>> Infix : is only allowed after the first argument of a non-method call.
>>> In other positions, it's a syntax error.
>>>
>>>
>>> How does the above explanation related to the case in hand @x .= sort: {
>>> ... }; ? Is sort an invocant? Or I miss something.
>>>
>>> Regards
>>>
>>> Xin
>>>
>>>
>>>
>>> On Jun 9, 2018, at 12:44 PM, Brandon Allbery 
>>> wrote:
>>>
>>> More precisely, at that point you have a bunch of numbers, but possibly
>>> not as many as expected if some of the components weren't numeric (or all
>>> of them, as when there are files present that aren't the expected logs).
>>> Which means some or all of those variables will be undefined instead of
>>> numbers. The // replaces those with the following value (0), so they do
>>> something sensible when sorted instead of producing warnings.
>>>
>>> On Sat, Jun 9, 2018 at 11:40 AM Xin Cheng  wrote:
>>>
>>>> This is very interesting. But I wonder how it works. I can understand
>>>> the first line
>>>>
>>>>  my ($month, $day, $year, $hour, $minute, $second) = .comb(/\d+/);
>>>>
>>>> Which extract the variables from $_. What is the second line doing, it
>>>> is very concise.
>>>>
>>>>  ($year // 0, $month // 0, $day // 0, $hour // 0, $minute // 0,
>>>> $second // 0, $_);
>>>>
>>>> Could somebody explain in some more words.? What does  // do? Why it
>>>> sorts the array?
>>>>
>>>> Regards
>>>>
>>>> Xin
>>>>
>>>> On Jun 9, 2018, at 12:51 AM, Timo Paulssen  wrote:
&g

Re: need second pair of eyes

2018-06-12 Thread Brandon Allbery
I don't expect

  if $Line ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |

does what you expect. In fact, I'm not sure what you expect there; those
|-s are going to be taken as slip prefix operators, and the second one
indeed will gobble the following block as the expression it applies to.

On Tue, Jun 12, 2018 at 6:42 PM ToddAndMargo  wrote:

> Hi Alk,
>
> What am I dong wrong here?
>
>
> $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz"; if $Line
> ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |  {say "yes"}
> else {say "no};'
>
> ===SORRY!===
> Expression needs parens to avoid gobbling block
> at -e:1
> --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
> Missing block (apparently claimed by expression)
> at -e:1
> --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>
>
> :'(
>
> -T
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need second pair of eyes

2018-06-12 Thread Brandon Allbery
No, you are stuck with

$foo ~~ m|xxx| && $foo ~~ m|yyy|

or

$foo ~~ m|xxx .* yyy|

(the latter assuming they always happen in that order; if they don't, you
can only use the first.)

On Tue, Jun 12, 2018 at 8:25 PM ToddAndMargo  wrote:

> On 06/12/2018 05:19 PM, Brandon Allbery wrote:
> > You're trying to do it all in one regex. That doesn't work; what you
> > tried will attempt to test that the same *substring* of the regex
> > matches both of those, which is not possible because they're both
> > literal. So any given substring has to be one, the other, or neither, it
> > can't simultaneously be both.
>
> So I am stuck with using "/"
>
> Thank you for the help.
>
> -T
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need second pair of eyes

2018-06-12 Thread Brandon Allbery
You're trying to do it all in one regex. That doesn't work; what you tried
will attempt to test that the same *substring* of the regex matches both of
those, which is not possible because they're both literal. So any given
substring has to be one, the other, or neither, it can't simultaneously be
both.

Either use two different matches, or put something like  .*  in between
instead of trying to use & or &&.

On Tue, Jun 12, 2018 at 8:15 PM ToddAndMargo  wrote:

>  >
>  > On Tue, Jun 12, 2018 at 7:35 PM ToddAndMargo   > <mailto:toddandma...@zoho.com>> wrote:
>  >
>  > On 06/12/2018 03:41 PM, ToddAndMargo wrote:
>  >  > Hi Alk,
>  >  >
>  >  > What am I dong wrong here?
>  >  >
>  >  >
>  >  > $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz"; if
>  > $Line
>  >  > ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |  {say
>  > "yes"}
>  >  > else {say "no};'
>  >  >
>  >  > ===SORRY!===
>  >  > Expression needs parens to avoid gobbling block
>  >  > at -e:1
>  >  > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>  >  > Missing block (apparently claimed by expression)
>  >  > at -e:1
>  >  > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
>  >  >
>  >  >
>  >  > :'(
>  >  >
>  >  > -T
>  >
>  >
>  > This fixed it:
>  >
>  > $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if
> $Line
>  > ~~ / "wine-patched\/archive\/staging\-\/" / & / ".tar.gz" /  {say
>  > "yes"}
>  > else {say "no"};'
>  >
>  >
>  > How do I use "|" instead of "/"?  I am trying to rid myself of the
>  > /\/\//\//\\/\/  tree
>  > On 06/12/2018 04:37 PM, Brandon Allbery wrote:
> > Same as in perl 5:  m ... 
> >
> > m|xxx|
>
> so I have to include the m
>
> Doesn't work
>
>
> $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if $Line
> ~~ m| "wine-patched\/archive\/staging\-\/"  &  ".tar.gz" |  {say "yes"}
> else {say "no"};'
> no
>
>
> :'(
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need second pair of eyes

2018-06-12 Thread Brandon Allbery
Same as in perl 5:  m ... 

m|xxx|


On Tue, Jun 12, 2018 at 7:35 PM ToddAndMargo  wrote:

> On 06/12/2018 03:41 PM, ToddAndMargo wrote:
> > Hi Alk,
> >
> > What am I dong wrong here?
> >
> >
> > $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz"; if $Line
> > ~~ | "wine-patched/archive/staging-/"   &&   ".tar.gz " |  {say "yes"}
> > else {say "no};'
> >
> > ===SORRY!===
> > Expression needs parens to avoid gobbling block
> > at -e:1
> > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
> > Missing block (apparently claimed by expression)
> > at -e:1
> > --> ging-/"   &&   ".tar.gz " |  {say "yes"}⏏ else {say "no};
> >
> >
> > :'(
> >
> > -T
>
>
> This fixed it:
>
> $ p6 'my $Line = "wine-patched/archive/staging-/x.tar.gz";if $Line
> ~~ / "wine-patched\/archive\/staging\-\/" / & / ".tar.gz" /  {say "yes"}
> else {say "no"};'
>
>
> How do I use "|" instead of "/"?  I am trying to rid myself of the
> /\/\//\//\\/\/  tree
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brandon Allbery
I replied to this one in private, but I want to make a point in public as
well.

On Tue, Jun 12, 2018 at 4:24 PM Brad Gilbert  wrote:

> The barrier is not with Stack Overflow. (←What I obviously meant)
> The barrier is within you.
>

There's an insidious assumption hidden in here: that "the barrier is within
you" means it's a modifiable barrier. Or, for that matter, it should be.

For some of us, it's not. I was not overstating earlier when I made a
reference to the Nobel Prize.
And there are also those for whom it's not as modifiable as this attitude
assumes, or for whom modifying it is not the best of ideas.

Think about this one a bit next time you want to tell someone it's "all in
their head". Because it might just be literally true.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
I should clarify this, but I'm not recalling full details at the moment
which is why I didn't originally.

Perl uses a metaobject protocol (MOP, which you'll see in various places in
the docs). The "macro" to access the metaobject is the .HOW pseudo-method.
If you do this for a normal class or object of that class, you get
Perl6::Metamodel::ClassHOW back. This is what the .^method syntax is
accessing; it's short for (thing).HOW.method((thing), ...). The metaclass
doesn't magically know its children, so the object has to be used once to
get at its metaclass and a second time to tell the metaclass what it is to
introspect.

I'm not seeing documentation for what .WHAT actually does; it (correctly)
notes that it's implemented specially within the compiler (hence "macro")
but not how you achieve it otherwise. Then again, .HOW has the same issue;
there's a bit of a bootstrapping issue with getting at the metamodel, you
need to have it first. Which is why it's wired into the compiler and gets
those uppercase pseudo-method names.

On Tue, Jun 12, 2018 at 3:00 PM Brandon Allbery  wrote:

> .WHAT is a "macro"/shorthand, which is why it's uppercase. There's a
> metamodel (the real meaning of the ^) version of it as well.
>
> On Tue, Jun 12, 2018 at 2:59 PM Joseph Brenner  wrote:
>
>> >> say @y.^WHAT
>>
>> > If you want to print the name use `.^name`.
>>
>> > If you want the type object for more advanced usages use `.WHAT`.
>>
>> Sorry, typo on my part.
>>
>> Though that raises another syntactic oddity I might whine about: perl6
>> code examples frequently use ".WHAT".  I was interested in getting a
>> list of all available methods, so I started trying some guesses:
>> ".METHODS", ".METHOD", ".methods" But actually it's ".^methods".
>> Okay, the caret is used for introspection... but then why isn't it
>> ".^what"?
>>
>> (It also turns out that the list ".^methods" gives you is bizarre:
>> hard to read, has many duplicates, unsorted, full of odd entries that
>> look like internal use only widgets I don't care about just now...)
>>
>>
>>
>>
>> On Tue, Jun 12, 2018 at 11:34 AM, Brad Gilbert  wrote:
>> > On Tue, Jun 12, 2018 at 12:55 PM, Joseph Brenner 
>> wrote:
>> >> Thanks, both your suggestion and JJ Merelo's work, but I think I like
>> >> yours for readability:
>> >>
>> >>   # # using binding, suggested by JJ Merelo 
>> >>   # my @y := @x but LookInside;
>> >>
>> >>   # suggested by Elizabeth Mattijsen l...@dijkmat.nl
>> >>   my @y does LookInside = @x;
>> >>
>> >> I actually found the use of "but" in the objects docs to be
>> >> tremendously confusing at first:  it looks like some sort of
>> >> conditional check, like "unless".
>> >
>> > The reason `but` exists is basically for the following
>> >
>> > my $v = 0 but True;
>> >
>> > if $v { say $v } # prints 0
>> >
>> > In Perl 5 it is common to return the string `"0 but true"` for a value
>> that is
>> > both 0 and true.
>> >
>> > Since one of the design philosophies of Perl 6 is to reduce the number
>> > of special cases this was made to be more generally useful.
>> >
>> > Note that you should not do the following
>> >
>> > my $v = 0;
>> > $v does True;
>> >
>> > say 'WTF!' if 0; # prints WTF!
>> >
>> > Basically you can use `but` anywhere you like, but be careful with
>> `does`.
>> >
>> >> On Tue, Jun 12, 2018 at 1:01 AM, Elizabeth Mattijsen 
>> wrote:
>> >>>> On 12 Jun 2018, at 09:06, Joseph Brenner  wrote:
>> >>>>
>> >>>> I thought this would work to make a copy of @x but with the role
>> >>>> "LookInside" attached to it:
>> >>>>
>> >>>>   my @y = @x but LookInside;
>> >>>>
>> >>>> But that didn't add the role to @y. E.g.
>> >
>> > That is effectively the same as:
>> >
>> > my @y = (@x but LookInside).map: *.self;
>> >
>> > That is @ sigiled variables tend to slurp in iterable values.
>> >
>> >>>>  say @y.^WHAT
>> >
>> > If you want to print the name use `.^name`.
>> >
>> > If you want the type object for more advanced usages use `.WHAT`.
>> >
>> >>>>
>> >>>> Would just report (Array), not (Array+{LookInside}).
>> >>>
>> >>> What you’re doing here, is assigning the elements of an Array but
>> Lookinside to a normal Array.  The elements of the Array do not have any
>> roles mixed in, so you wind up with a normal Array with normal elements in
>> them.  Perhaps you meant:
>> >>>
>> >>> my @y does LookInside = @x;
>> >>>
>> >>> Here you create an Array @y with the role LookInside mixed in, and
>> *then* assign the values from @x.
>> >>>
>>
>
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: stackoverflow vs the world (and perl6-users)

2018-06-12 Thread Brandon Allbery
On Tue, Jun 12, 2018 at 3:38 PM Brad Gilbert  wrote:

> > The barrier is non-existent.
>
> I have only ever heard about speculated and imagined barriers.
>

This is not proof that such barriers don't exist. I hit the magic 2
mark and lasted less than a week afterward because the rules suddenly
changed in a way that induced severe social anxiety. Again, this is not
something "fixable", not on my end.

You are not everyone. Don't assume what works for you necessarily works for
everyone. Or that there are quick and accessible workarounds for everyone.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
.WHAT is a "macro"/shorthand, which is why it's uppercase. There's a
metamodel (the real meaning of the ^) version of it as well.

On Tue, Jun 12, 2018 at 2:59 PM Joseph Brenner  wrote:

> >> say @y.^WHAT
>
> > If you want to print the name use `.^name`.
>
> > If you want the type object for more advanced usages use `.WHAT`.
>
> Sorry, typo on my part.
>
> Though that raises another syntactic oddity I might whine about: perl6
> code examples frequently use ".WHAT".  I was interested in getting a
> list of all available methods, so I started trying some guesses:
> ".METHODS", ".METHOD", ".methods" But actually it's ".^methods".
> Okay, the caret is used for introspection... but then why isn't it
> ".^what"?
>
> (It also turns out that the list ".^methods" gives you is bizarre:
> hard to read, has many duplicates, unsorted, full of odd entries that
> look like internal use only widgets I don't care about just now...)
>
>
>
>
> On Tue, Jun 12, 2018 at 11:34 AM, Brad Gilbert  wrote:
> > On Tue, Jun 12, 2018 at 12:55 PM, Joseph Brenner 
> wrote:
> >> Thanks, both your suggestion and JJ Merelo's work, but I think I like
> >> yours for readability:
> >>
> >>   # # using binding, suggested by JJ Merelo 
> >>   # my @y := @x but LookInside;
> >>
> >>   # suggested by Elizabeth Mattijsen l...@dijkmat.nl
> >>   my @y does LookInside = @x;
> >>
> >> I actually found the use of "but" in the objects docs to be
> >> tremendously confusing at first:  it looks like some sort of
> >> conditional check, like "unless".
> >
> > The reason `but` exists is basically for the following
> >
> > my $v = 0 but True;
> >
> > if $v { say $v } # prints 0
> >
> > In Perl 5 it is common to return the string `"0 but true"` for a value
> that is
> > both 0 and true.
> >
> > Since one of the design philosophies of Perl 6 is to reduce the number
> > of special cases this was made to be more generally useful.
> >
> > Note that you should not do the following
> >
> > my $v = 0;
> > $v does True;
> >
> > say 'WTF!' if 0; # prints WTF!
> >
> > Basically you can use `but` anywhere you like, but be careful with
> `does`.
> >
> >> On Tue, Jun 12, 2018 at 1:01 AM, Elizabeth Mattijsen 
> wrote:
>  On 12 Jun 2018, at 09:06, Joseph Brenner  wrote:
> 
>  I thought this would work to make a copy of @x but with the role
>  "LookInside" attached to it:
> 
>    my @y = @x but LookInside;
> 
>  But that didn't add the role to @y. E.g.
> >
> > That is effectively the same as:
> >
> > my @y = (@x but LookInside).map: *.self;
> >
> > That is @ sigiled variables tend to slurp in iterable values.
> >
>   say @y.^WHAT
> >
> > If you want to print the name use `.^name`.
> >
> > If you want the type object for more advanced usages use `.WHAT`.
> >
> 
>  Would just report (Array), not (Array+{LookInside}).
> >>>
> >>> What you’re doing here, is assigning the elements of an Array but
> Lookinside to a normal Array.  The elements of the Array do not have any
> roles mixed in, so you wind up with a normal Array with normal elements in
> them.  Perhaps you meant:
> >>>
> >>> my @y does LookInside = @x;
> >>>
> >>> Here you create an Array @y with the role LookInside mixed in, and
> *then* assign the values from @x.
> >>>
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: How do I remove leading zeros?

2018-06-13 Thread Brandon Allbery
https://docs.perl6.org/language/unicode_entry

I have right Alt set as my Compose key, so it'd be [right-Alt] < <

(At some point I should see if I can put in some information about
WinCompose, since I think I'm currently the only one with any experience
with it.)

On Wed, Jun 13, 2018 at 2:09 PM ToddAndMargo  wrote:

> On 06/13/2018 11:06 AM, ToddAndMargo wrote:
> > On 06/13/2018 11:03 AM, ToddAndMargo wrote:
> >> On 06/13/2018 11:00 AM, Larry Wall wrote:
>
> > $ p6 'my $x = "01.000.103.006.10"; $x ~~ s:g/«0+)>\d//; say "$x"'
> > 1.0.103.6.10
>
> Hi Larry,
>
>  How did you get thee "«" character to appear?  And
> what does it mean?
>
> Many thanks,
> -T
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: How do I remove leading zeros?

2018-06-13 Thread Brandon Allbery
https://docs.perl6.org/language/regexes#Capture_markers:_%3C(_)%3E

On Wed, Jun 13, 2018 at 3:10 PM Xin Cheng  wrote:

> Now we know the meaning of >> and <<. But what about <( and )> ? What do
> they mean here?
>
> Thanks.
> Xin
>
> On Jun 13, 2018, at 2:18 PM, Brad Gilbert  wrote:
>
> On Wed, Jun 13, 2018 at 1:09 PM ToddAndMargo 
> wrote:
>
>
> On 06/13/2018 11:06 AM, ToddAndMargo wrote:
>
> On 06/13/2018 11:03 AM, ToddAndMargo wrote:
>
> On 06/13/2018 11:00 AM, Larry Wall wrote:
>
>
>$ p6 'my $x = "01.000.103.006.10"; $x ~~ s:g/«0+)>\d//; say "$x"'
>1.0.103.6.10
>
>
> Hi Larry,
>
> How did you get thee "«" character to appear?  And
> what does it mean?
>
>
> The way I type them is [compose] [<] [<], which is nice because their
> ASCII equivalent is <<
>
> It means match a word boundary with the word being on the right side.
>
> say 'ABC DEF ' ~~ m:g/ << . /
>
>(「A」 「D」)
>
> say 'ABC DEF ' ~~ m:g/ >> . /
>
>(「 」 「 」)
>
>
>

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: EVAL?

2018-06-13 Thread Brandon Allbery
Exactly what it says: eval is a code injection attack waiting to happen. If
you actually need it, you get to do your own data sanitization, and you
tell Perl 6 you did so with "use MONKEY-SEE-NO-EVAL;".

On Wed, Jun 13, 2018 at 3:22 PM ToddAndMargo  wrote:

> Hi All,
>
> I am converting a program from Perl5 to Perl 6.
>
> This line
>
>   else { eval "$RunSpecific"; }
>
> became this line
>
>   else { EVAL "$RunSpecific"; }
>
> And threw this error
>
> $ perl6 -c GetUpdates.pl6
> ===SORRY!=== Error while compiling /home/linuxutil/GetUpdates.pl6
> EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma
> to override this error,
> but only if you're VERY sure your data contains no injection attacks)
> at /home/linuxutil/GetUpdates.pl6:6016
> --> else { EVAL "$RunSpecific"⏏; }
>
>
> Any words of wisdom?
>
>
> Many thanks,
> -T
>
>
> --
> ~~~
> Serious error.
> All shortcuts have disappeared.
> Screen. Mind. Both are blank.
> ~~~
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: RFE: eval documentation

2018-06-14 Thread Brandon Allbery
I think the message is obscure for a reason: the last thing you want is for
someone to make an insecure module look "safe" by just dropping that pragma
into it. You want to make them think about what they are doing.

On Thu, Jun 14, 2018 at 1:32 PM ToddAndMargo  wrote:

> Dear Perl6 Developers,
>
> https://docs.perl6.org/language/5to6-perlfunc#eval
>
> Would you please consider adding
>
>   ::('&' ~ $RunSpecific)()
>   &::($RunSpecific)()
>
> to the documentation, as well as an explanation of
> the error message when using EVAL
>
> ===SORRY!=== Error while compiling /home/linuxutil/GetUpdates.pl6
> EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma
> to override this error,
> but only if you're VERY sure your data contains no injection attacks)
> at /home/linuxutil/GetUpdates.pl6:6016
> --> else { EVAL "$RunSpecific"⏏; }
>
> Be sure to turn the "use the MONKEY-SEE-NO-EVAL pragma" phrase into
> `use MONKEY-SEE-NO-EVAL;` as the sentence is to obscure otherwise.
>
>
> Many thanks,
> -T
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: EVAL?

2018-06-14 Thread Brandon Allbery
Not to mention "language designer isn't from your culture, and the word has
different connotations in theirs". The eastern (or for that matter western)
US does not define the world.

On Thu, Jun 14, 2018 at 1:57 PM Brandon Allbery  wrote:

> You can never be certain in *any* case. Check if you're not sure what it
> means. Because sometimes languages use some term in a way you don't expect,
> whether because they drew it from some specific discipline (Haskell uses a
> lot of terminilogy from abstract mathematics, for example) or for some
> reason (I've hit a few cases where the language author didn't know the
> actual meaning of some term and used it "oddly" as a result).
>
> https://docs.perl6.org/language/glossary
>
> Which doesn't have "pragma" in it, probably because it's not specific to
> Perl. It's been around, and used in this sense, since at least the 1960s
> and probably earlier.
>
> So also check various CS glossaries.
> Such as FOLDOC: http://foldoc.org/pragma
>
> On Thu, Jun 14, 2018 at 1:52 PM ToddAndMargo 
> wrote:
>
>> On 06/14/2018 10:49 AM, Brandon Allbery wrote:
>> > That's actually the origin of it: pragmatic / real-world behavior, as
>> > opposed to idealized situations.
>>
>> I can't always tell when things are English and when
>> things are Perl.
>>
>
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: EVAL?

2018-06-14 Thread Brandon Allbery
I'm trying to not second-guess whoever maintains the glossary. And by that
message also pointing up the omission.

On Thu, Jun 14, 2018 at 2:01 PM The Sidhekin  wrote:

> On Thu, Jun 14, 2018 at 7:57 PM, Brandon Allbery 
> wrote:
>
>> You can never be certain in *any* case. Check if you're not sure what it
>> means. Because sometimes languages use some term in a way you don't expect,
>> whether because they drew it from some specific discipline (Haskell uses a
>> lot of terminilogy from abstract mathematics, for example) or for some
>> reason (I've hit a few cases where the language author didn't know the
>> actual meaning of some term and used it "oddly" as a result).
>>
>> https://docs.perl6.org/language/glossary
>>
>> Which doesn't have "pragma" in it, probably because it's not specific to
>> Perl. It's been around, and used in this sense, since at least the 1960s
>> and probably earlier.
>>
>
>   ... but does have "whitespace" and "variable" in it, neither of which is
> specific to Perl. :-P
>
>   Isn't the lack of "pragma" there an omission to be corrected?
>
>   Particularly if the term is required for the reading of error messages?
>
>
> Eirik
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: EVAL?

2018-06-14 Thread Brandon Allbery
That's just a different variant of an old shell "hack": drop a program
named "test" somewhere where root might run a shell script.

Which is why root's path no longer includes the current directory, and
these days nothing outside the system directories.

On Thu, Jun 14, 2018 at 1:37 PM ToddAndMargo  wrote:

> On 06/14/2018 10:30 AM, Brandon Allbery wrote:
> > In short, pragmas are all-same-case "use" names; instead of loading
> > code, they tell the compiler to change its behavior.
> >
> > The MONKEY-* pragmas generally control various kinds of unsafe or
> > dangerous behavior, including direct access to the mechanisms underneath
> > / "supporting" Rakudo and things like EVAL. Other all-uppercase names
> > also generally represent "dangerous" actions or options.
> >
> > There are a few pragmas that are all lowercase instead of all uppercase;
> > they also change the compiler's behavior, but are safer than the
> > all-uppercase ones. "use lib" is one of them. (This is why modules are
> > generally mixed-case names.)
>
>
> Thank you!
>
> Speaking of dangerous, go find a perl program being run by root,
> inject some code into one of its modules, and ...
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: EVAL?

2018-06-14 Thread Brandon Allbery
In short, pragmas are all-same-case "use" names; instead of loading code,
they tell the compiler to change its behavior.

The MONKEY-* pragmas generally control various kinds of unsafe or dangerous
behavior, including direct access to the mechanisms underneath /
"supporting" Rakudo and things like EVAL. Other all-uppercase names also
generally represent "dangerous" actions or options.

There are a few pragmas that are all lowercase instead of all uppercase;
they also change the compiler's behavior, but are safer than the
all-uppercase ones. "use lib" is one of them. (This is why modules are
generally mixed-case names.)

https://docs.perl6.org/language/pragmas for more information.

On Thu, Jun 14, 2018 at 1:22 PM ToddAndMargo  wrote:

> On 06/13/2018 12:27 PM, Brandon Allbery wrote:
> > Exactly what it says: eval is a code injection attack waiting to happen.
> > If you actually need it, you get to do your own data sanitization, and
> > you tell Perl 6 you did so with "use MONKEY-SEE-NO-EVAL;".
>
> Hi Brandon,
>
> Thank you for clarifying.  My hand up with the error message
> was its wording:
>
> "use the MONKEY-SEE-NO-EVAL pragma to override this error"
>
> 1) I did not realize the the word "use" mean the Perl "use".
> I though it meant the English usages as in go do something.
>
> 2) what the heck is a "pragma"?  Way to obscure.
>
> Your response cleared up the misunderstanding nicely.
>
> -T
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: EVAL?

2018-06-14 Thread Brandon Allbery
That's actually the origin of it: pragmatic / real-world behavior, as
opposed to idealized situations.

On Thu, Jun 14, 2018 at 1:47 PM ToddAndMargo  wrote:

> On 06/14/2018 10:43 AM, The Sidhekin wrote:
> >
> >More relevant, Perl 6 documentation:
> > https://docs.perl6.org/language/pragmas
>
> You are presuming I knew the word was a Perl word.
> I though it was English, as in pragmatic
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: EVAL?

2018-06-14 Thread Brandon Allbery
You can never be certain in *any* case. Check if you're not sure what it
means. Because sometimes languages use some term in a way you don't expect,
whether because they drew it from some specific discipline (Haskell uses a
lot of terminilogy from abstract mathematics, for example) or for some
reason (I've hit a few cases where the language author didn't know the
actual meaning of some term and used it "oddly" as a result).

https://docs.perl6.org/language/glossary

Which doesn't have "pragma" in it, probably because it's not specific to
Perl. It's been around, and used in this sense, since at least the 1960s
and probably earlier.

So also check various CS glossaries.
Such as FOLDOC: http://foldoc.org/pragma

On Thu, Jun 14, 2018 at 1:52 PM ToddAndMargo  wrote:

> On 06/14/2018 10:49 AM, Brandon Allbery wrote:
> > That's actually the origin of it: pragmatic / real-world behavior, as
> > opposed to idealized situations.
>
> I can't always tell when things are English and when
> things are Perl.
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: Malformed UTF-8?

2018-06-16 Thread Brandon Allbery
Something's wrong with the data file you are reading. Perl 6 is expecting
UTF-8 encoding and getting something else (usually an ISO-8859 encoding).

On Sat, Jun 16, 2018 at 1:09 AM ToddAndMargo  wrote:

> rakudo-pkg-Fedora28-2018.05-01.x86_64.rpm
> $ perl6 -v
> This is Rakudo version 2018.05 built on MoarVM version 2018.05
> implementing Perl 6.c.
>
>
> What did I do wrong, this time?
>
> Malformed UTF-8
>in sub RotateZipFile at /home/linuxutil/CimCheck.pl6 line 290
>
> 290:   @ReverseLogs = @Logs.sort: {my ($month, $day, $year, $hour,
> $minute, $second) = .comb(/\d+/);($year // 0, $month // 0, $day // 0,
> $hour // 0, $minute // 0,$second // 0, $_);}
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: IO ???

2018-06-16 Thread Brandon Allbery
If you're performing an I/O operation on an IO::Path, either it's a
metadata operation (e.g. file tests) or you are operating on the whole file
(e.g. .lines). In the former case there is no handle; in the latter, the
handle exists only while .lines is active; that is, it exists only within
the implementation of the .lines method, it is not part of the IO::Path
object.

In short, an IO::Path is not a funny-looking handle. IO::Path methods may
internally use private handles, and thereby control their lifetimes. (It
should be closed when it goes out of scope, i.e. when the .lines method is
done, even if it's not explicitly closed.)


On Sat, Jun 16, 2018 at 1:00 PM Xin Cheng  wrote:

> I am wondering why the IO::Path class doesn't have a "close" method. After
> I read from a file by
>
> $filename.IO.lines -> $line;
>
> Am I supposed to close the file, or it is automatically closed for me
> after the reading?
>
> I tried something like
>
> $filename.IO.close;
>
> It is a runtime error. It seems to me that no need to close. Do I
> understand right? If so, why?
>
> Regards
>
> Xin
>
> On Jun 3, 2018, at 1:05 PM, ToddAndMargo  wrote:
>
> On Sun, Jun 3, 2018 at 1:01 PM ToddAndMargo  mailto:toddandma...@zoho.com >> wrote:
>Hi All,
>I have a been looking around the docs pages and I am
>not finding a list of what the various IO functions do.
>I would like a list of IO.e does this and IO.d
>does that.
>Any such list exist?
>Many thanks,
>-T
>
>
> On 06/03/2018 10:03 AM, Brandon Allbery wrote:
>
> It's a bit subtle to track down, but the IO method gives you an IO::Path
> object. https://docs.perl6.org/type/IO::Path
>
>
> I had found that, but I did not know what I was looking at.
> Thank you!
>
>
>

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need sort help

2018-06-08 Thread Brandon Allbery
You didn't use what I sent. It's $^x and $^y, not $a and $b.

(Aside: I *really* wish placeholders didn't work that way; this thread is
demonstrating why it's a bad idea. Not to mention a pain in the butt.)


On Sat, Jun 9, 2018 at 12:12 AM ToddAndMargo  wrote:

> >>> @x.sort: {
> >>>my $a = $^x ~~ m:g/\d+/;
> >>>my $b = $^y ~~ m:g/\d+/;
> >>>$a[6].defined cmp $b[6].defined
> >>>??
> >>>  $a[3] cmp $b[3]
> >>>|| $a[1] cmp $b[1]
> >>>|| $a[2] cmp $b[2]
> >>>|| $a[4] cmp $b[4]
> >>>|| $a[5] cmp $b[5]
> >>>|| $a[6] cmp $b[6]
> >>>|| $x cmp $y
> >>>!! $x cmp $y
> >>> };
> >>
> >> On Fri, Jun 8, 2018 at 11:53 PM ToddAndMargo  >> <mailto:toddandma...@zoho.com>> wrote:
> >>
> >> On 06/08/2018 07:00 PM, Brent Laabs wrote:
> >>  > let me revise that
> >>  >
> >>  > @x.sort: {
> >>  >my $a = $^a ~~ m:g/\d+/;
> >>  >my $b = $^b ~~ m:g/\d+/;
> >>  >$a[6].defined cmp $b[6].defined
> >>  >??
> >>  >  $a[3] cmp $b[3]
> >>  >|| $a[1] cmp $b[1]
> >>  >|| $a[2] cmp $b[2]
> >>  >|| $a[4] cmp $b[4]
> >>  >|| $a[5] cmp $b[5]
> >>  >|| $a[6] cmp $b[6]
> >>  >|| $^a cmp $^b
> >>  >!! $^a cmp $^b
> >>  > };
> >>  >
> >>
> >>
> >> $   ls | perl6 -e 'my @x=slurp(); @x.sort: { my $a = $^a ~~
> m:g/\d+/;my
> >> $b = $^b ~~ m:g/\d+/;$a[6].defined cmp $b[6].defined ?? $a[3] cmp
> $b[3]
> >> || $a[1] cmp $b[1] || $a[2] cmp $b[2] || $a[4] cmp $b[4]  || $a[5]
> cmp
> >> $b[5]  || $a[6] cmp $b[6] || $^a cmp $^b !! $^a cmp $^b a cmp $^b'
> $^a
> >> cmp $^b
> >> ===SORRY!=== Error while compiling -e
> >> Redeclaration of symbol '$^a' as a placeholder parameter
> >> at -e:1
> >> --> my @x=slurp(); @x.sort: { my $a = $^a⏏ ~~ m:g/\d+/; my $b =
> $^b
> >> ~~ m:g/\d+/;$a
>
> On 06/08/2018 09:03 PM, Brandon Allbery wrote:
> > Brent thinkoed that slightly. (Forgot that first use of a placeholder
> > "declares" it, and thereafter you don't use the ^. Which then collides
> > with the local "my" variables.)
> >
>
>
> $   ls | perl6 -e 'my @x=slurp(); @x.sort: { my $a = $a ~~ m:g/\d+/; my
> $b = $b ~~ m:g/\d+/;$a[6].defined cmp $b[6].defined ?? $a[3] cmp $b[3]
> || $a[1] cmp $b[1] || $a[2] cmp $b[2] || $a[4] cmp $b[4]  || $a[5] cmp
> $b[5]  || $a[6] cmp $b[6] || $^a cmp $^b !! $^a cmp $^b a cmp $^b' $^a
> cmp $^b
> ===SORRY!=== Error while compiling -e
> Cannot use variable $a in declaration to initialize itself
> at -e:1
> --> my @x=slurp(); @x.sort: { my $a = $⏏a ~~ m:g/\d+/; my $b = $b ~~
> m:g/\d+/;$a
>  expecting any of:
>  term
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need sort help

2018-06-08 Thread Brandon Allbery
Brent thinkoed that slightly. (Forgot that first use of a placeholder
"declares" it, and thereafter you don't use the ^. Which then collides with
the local "my" variables.)

> @x.sort: {
>my $a = $^x ~~ m:g/\d+/;
>my $b = $^y ~~ m:g/\d+/;
>$a[6].defined cmp $b[6].defined
>??
>  $a[3] cmp $b[3]
>|| $a[1] cmp $b[1]
>|| $a[2] cmp $b[2]
>|| $a[4] cmp $b[4]
>|| $a[5] cmp $b[5]
>|| $a[6] cmp $b[6]
>|| $x cmp $y
>!! $x cmp $y
> };

On Fri, Jun 8, 2018 at 11:53 PM ToddAndMargo  wrote:

> On 06/08/2018 07:00 PM, Brent Laabs wrote:
> > let me revise that
> >
> > @x.sort: {
> >my $a = $^a ~~ m:g/\d+/;
> >my $b = $^b ~~ m:g/\d+/;
> >$a[6].defined cmp $b[6].defined
> >??
> >  $a[3] cmp $b[3]
> >|| $a[1] cmp $b[1]
> >|| $a[2] cmp $b[2]
> >|| $a[4] cmp $b[4]
> >|| $a[5] cmp $b[5]
> >|| $a[6] cmp $b[6]
> >|| $^a cmp $^b
> >!! $^a cmp $^b
> > };
> >
>
>
> $   ls | perl6 -e 'my @x=slurp(); @x.sort: { my $a = $^a ~~ m:g/\d+/;my
> $b = $^b ~~ m:g/\d+/;$a[6].defined cmp $b[6].defined ?? $a[3] cmp $b[3]
> || $a[1] cmp $b[1] || $a[2] cmp $b[2] || $a[4] cmp $b[4]  || $a[5] cmp
> $b[5]  || $a[6] cmp $b[6] || $^a cmp $^b !! $^a cmp $^b a cmp $^b' $^a
> cmp $^b
> ===SORRY!=== Error while compiling -e
> Redeclaration of symbol '$^a' as a placeholder parameter
> at -e:1
> --> my @x=slurp(); @x.sort: { my $a = $^a⏏ ~~ m:g/\d+/; my $b = $^b
> ~~ m:g/\d+/;$a
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: need sort help

2018-06-08 Thread Brandon Allbery
@x.sort: {
   my $a = $^x ~~ m:g/\d+/;
   my $b = $^y ~~ m:g/\d+/;
   $a[6].defined cmp $b[6].defined
   ??
 $a[3] cmp $b[3]
   || $a[1] cmp $b[1]
   || $a[2] cmp $b[2]
   || $a[4] cmp $b[4]
   || $a[5] cmp $b[5]
   || $a[6] cmp $b[6]
   || $x cmp $y
   !! $x cmp $y
};

This is what I sent before, minus the leading "> " that I'd neglected to
remove.

Please note the second line does NOT say "my $a = $a ~~ m:g/\d+/;", which
is what you had and what produced the error you pasted. I don't know where
you got that. Likewise the third line with $b and $^y (where again you had
$b instead).

On Sat, Jun 9, 2018 at 12:19 AM ToddAndMargo  wrote:

> On 06/08/2018 09:16 PM, Brandon Allbery wrote:
> > You didn't use what I sent. It's $^x and $^y, not $a and $b.
>
> I am lost.  Would you mind writing it out for me?
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
Smileys do not change "use … whenever possible". It;s still asserting there
is one correct way to contribute.


On Tue, Jun 12, 2018 at 1:07 PM Curt Tilmes  wrote:

>
> On Tue, Jun 12, 2018 at 12:56 PM Brandon Allbery 
> wrote:
>
>> Which doesn't change the fact that there's what amounts to an
>> accessibility issue.
>>
>> Do you *really* want to tell some percentage of people that they must be
>> willing to use the One True Web Site, or else go away because they're not
>> wanted hereabouts? Because insisting all the time that "(also: ask
>> questions in StackOverflow whenever possible :-) )" is doing exactly that.
>>
>> On Tue, Jun 12, 2018 at 12:51 PM JJ Merelo  wrote:
>>
>>>
>>> Well, it really helps newcomers to find answers to their problems. It's
>>> well indexed, and it also raises visibility of the Perl6 language.
>>>
>>
> "must be willing", "insisting", etc. is a very different type of approach
> from the gentle "whenever possible" with a smiley.
>
> No one is "insisting" or telling people they aren't wanted hereabouts.
>
> Use StackOverflow if possible (for the reasons expressed) If not (for
> whatever reason, we won't pry), use perl6-users, that's ok too.
>
>

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
You really do want to be exclusionary, don't you?

yada yada stackoverflow is the one truth yada yada.

Enough.

On Tue, Jun 12, 2018 at 3:12 AM JJ Merelo  wrote:

> (also: ask questions in StackOverflow whenever possible :-) )
>
> El mar., 12 jun. 2018 a las 9:09, JJ Merelo ()
> escribió:
>
>> Use binding:
>>
>> my @x= <1 2 3>; my @y := @x but Iterable; say @y.^name; #  OUTPUT:
>> «Array+{Iterable}␤»
>>
>> El mar., 12 jun. 2018 a las 9:06, Joseph Brenner ()
>> escribió:
>>
>>> I thought this would work to make a copy of @x but with the role
>>> "LookInside" attached to it:
>>>
>>>my @y = @x but LookInside;
>>>
>>> But that didn't add the role to @y. E.g.
>>>
>>>   say @y.^WHAT
>>>
>>> Would just report (Array), not (Array+{LookInside}).
>>>
>>> I found that this would do what I was trying to do though:
>>>
>>>my @y = @x;
>>>@y does LookInside;
>>>
>>> I didn't think there would be any difference between the two
>>> though.  What am I not getting?
>>>
>>> The full code looks like this:
>>>
>>> trial_introspect.pl6:
>>>
>>>   use v6;
>>>   use Trial::Introspect;
>>>   my @x = ;
>>>   my @y = @x;
>>>   @y does LookInside;
>>>   say "Methods: ";
>>>   say @y.methodical_methods;
>>>
>>>
>>> .../Trial/Introspect.pm6:
>>>
>>>   role LookInside {
>>> method methodical_methods {
>>>   self.^methods.map({ .gist }).sort.unique.map({ "$_\n" }).grep({
>>> ! /^Method/ });
>>> }
>>>   }
>>>
>>
>>
>> --
>> JJ
>>
>
>
> --
> JJ
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
Which doesn't change the fact that there's what amounts to an accessibility
issue.

Do you *really* want to tell some percentage of people that they must be
willing to use the One True Web Site, or else go away because they're not
wanted hereabouts? Because insisting all the time that "(also: ask
questions in StackOverflow whenever possible :-) )" is doing exactly that.

On Tue, Jun 12, 2018 at 12:51 PM JJ Merelo  wrote:

>
>
> El mar., 12 jun. 2018 a las 18:34, Brandon Allbery ()
> escribió:
>
>> You really do want to be exclusionary, don't you?
>>
>> yada yada stackoverflow is the one truth yada yada.
>>
>
> Well, it really helps newcomers to find answers to their problems. It's
> well indexed, and it also raises visibility of the Perl6 language.
>
> Cheers
>
> JJ
>
>

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: mixin syntax: does vs but

2018-06-12 Thread Brandon Allbery
That was not "also", that was "this is the right way". "Ask questions in
StackOverflow whenever possible" does not leave room for "this is also a
good venue", it asserts that there is one proper venue and others are
discouraged.

It asserts that, for people who have difficulty using StackOverflow for
whatever reason, *they do not belong here*.

On Tue, Jun 12, 2018 at 1:01 PM JJ Merelo  wrote:

> Hi
>
> El mar., 12 jun. 2018 a las 18:56, Brandon Allbery ()
> escribió:
>
>> Which doesn't change the fact that there's what amounts to an
>> accessibility issue.
>>
>> Do you *really* want to tell some percentage of people that they must be
>> willing to use the One True Web Site, or else go away because they're not
>> wanted hereabouts? Because insisting all the time that "(also: ask
>> questions in StackOverflow whenever possible :-) )" is doing exactly that.
>>
>
>
> Sorry, I don't understand what you mean here. We're very happy with
> questions here, and I (and everyone else) answer them whenever I can. We
> ask people to *also* post them in StackOverflow if they have an account,
> and want, and have the time to do so, because I personally think it helps
> expand Perl6's community. It's OK if they don't. I posted the rationale
> after that here
> http://blogs.perl.org/users/jj_merelo/2018/04/stackoverflow-that.html I'm
> sorry if it sounds like kicking people out of here, because that wasn't
> really the intention.
>
> JJ
>


-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


<    1   2   3   4   >