cs can be clearer on when to use {} and when it isn't needed,
> opened an issue https://github.com/Raku/doc/issues/3478
>
> -y
>
>
> On Mon, Jun 15, 2020 at 3:09 PM Brad Gilbert wrote:
>
>> You don't want to use <{…}>, you want to use ""
>>
>>
>
> Although I would do something like this instead:
>
> my ($code,$desc) = $line.split( /\s+/, 2 );
> if %products{$code} eq $desc {
>
> On Sun, Jun 14, 2020 at 6:44 PM Joseph Brenner wrote:
>
>> In part because of the recent discussion here, I decided to
4/20, Vadim Belman wrote:
> It doesn't have to be an assertion. Just a code block would do the same.
>
> Best regards,
> Vadim Belman
>
>> On Jun 14, 2020, at 8:55 PM, Joseph Brenner wrote:
>>
>> $_ = "Alpha beta gamma";
>> my @matches = m:g/(a) /;
>
>
istake when I wrote it up, but whatever.)
On 6/14/20, Joseph Brenner wrote:
> Well, with the first one it rejects all of my lines, and with the
> second one it passes all of them.
>
> Just to be be clear, my idea is the second line is wrong, and it
> should flag that one as a pr
gt; NO: bad line.
> ...
> Why is it reading with an empty-string $0 in %products{''}
>
> -y
>
>
> On Sun, Jun 14, 2020 at 5:47 PM Joseph Brenner wrote:
>
>> Well, with the first one it rejects all of my lines, and with the
>> second one it passes all of them.
>>
By the way, I've been finding code assertions are a fun way of
spying on what's going on with your regexps:
$_ = "Alpha beta gamma";
my @matches = m:g/(a) /;
# 5
# 10
# 13
# 16
ave me some
> ideas
>
> Try matching against / (^P\d+) \s+ %products{$0} /
>
> This one also works, in a roundabout way
> / (^P\d+) \s+ {"%products{$0}"} /
> -y
>
>
> On Sun, Jun 14, 2020 at 4:44 PM Joseph Brenner wrote:
>
>> In part because of the
In part because of the recent discussion here, I decided to
play around with using Raku code embedded in a regexp.
I came up with a contrived example where I was going to
examine a product listing in a text block to see if the product
descriptions matched the product codes. The valid associations
No particular "killer app" has emerged for Raku as
of yet, there's no task that's going to make you go
"Aha, this is a job for Raku!". But you know, it's
not as though the original perl was designed to be
the Web 1.0 server-side scripting language or the
saviour of the human genome project...
Thanks much.
On 5/30/20, JJ Merelo wrote:
> Reopened
>
> El sáb., 30 may. 2020 a las 19:26, Joseph Brenner ()
> escribió:
>
>> I was just trying to comment on an issue I opened the other day, and I
>> accidentally closed it. I don't see any way for me to re-open it,
I was just trying to comment on an issue I opened the other day, and I
accidentally closed it. I don't see any way for me to re-open it, so
I would guess I don't have permissions to do so. Could someone
re-open this?
https://github.com/rakudo/rakudo/issues/3728
I opened a github issue:
https://github.com/rakudo/rakudo/issues/3728
On 5/26/20, Joseph Brenner wrote:
> Hey Brad, thanks much for the explication:
>
>> 「」 should probably also prevent the position from being at the
>> end.
>
>> It does work if you write it differ
ile the other one is something like:
>
> / ... /
>
> (The 「try」 is needed because 「.substr( -1 )」 is a Failure.)
>
> So then these:
>
> / ... $ /
> / ...
>
> Would be
>
> / ... /
> / ... /
>
> ---
>
> What I think is happenin
Given this string:
my $str = "Romp romp ROMP";
We can match just the first or last by using the usual pinning
features, '^' or '$':
say $str ~~ m:i:g/^romp/; ## (「Romp」)
say $str ~~ m:i:g/romp$/; ## (「ROMP」)
Moritz Lenz (Section 3.8 of 'Parsing', p32) makes
hat case the "qu" is just part of the string and fair
game to match against, so...)
On 5/16/20, Peter Pentchev wrote:
> On Sat, May 16, 2020 at 05:53:04PM -0700, Joseph Brenner wrote:
>> Peter Pentchev wrote:
>> > On Fri, May 15, 2020 at 07:32:50PM -0700, Joseph Br
op of each other.
I keep thinking there's an edge case in these before/after tricks that
might matter if we weren't matching the one-word-per-line format of
the unix dictionaries, but I need to think about that a little more...
Peter Pentchev wrote:
> On Fri, May 15, 2020 at 07:32:50PM
ations, not just the
permutations).
On 5/16/20, William Michels wrote:
> On Fri, May 15, 2020 at 7:33 PM Joseph Brenner wrote:
>>
>> Regex engines by their nature care a lot about order, but I
>> occasionally want to relax that to match for multiple
>> multicharacter s
Regex engines by their nature care a lot about order, but I
occasionally want to relax that to match for multiple
multicharacter subpatterns where the order of them doesn't
matter.
Frequently the simplest thing to do is just to just do multiple
matches. Let's say you're looking for words that
I'm having trouble doing a build of raku from github. Could it
be the INSTALL.txt file is out-of-date?
I was trying to build a "bleeding edge" Raku using the
instructions here:
https://github.com/rakudo/rakudo/blob/master/INSTALL.txt
So I thought I'd just need to do this:
cd
I just got to look into this one again a little further, and it does seem that
reading a utf16 file like this doesn't work:
my $contents = slurp( $file, :enc("utf16") );
Though this, however, does work:
my $fh = $file.IO.open( :r, :enc("utf16") );
my $contents = $fh.slurp;
kind text you've been reading, not just the number of bytes you've
read.
Is that making any sense? I posted a later code example that might
show the problem more clearly...
On 4/26/20, Samantha McVey wrote:
> On zaterdag 25 april 2020 21:51:41 CEST Joseph Brenner wrote:
>> > Yary ha
utf16") );
my $huh = $contents.gist;
say "contents: $contents";# contents:
say "length: ", $contents.chars;# 0
}
The output:
contents: ሀⶀ䷼ꪪⲤⲎ
length: 6
contents:
length: 0
The file definitely has something in it, though:
wc /tmp/stuff_in
Looking at the documentation for slurp, it looks as though there's a
convenient "enc" option you can use if you're not reading utf8 files.
So I thought this would work:
my $contents = slurp $file, enc => "utf16";
It's not doing what I expected... Raku acts like there's nothing in $contents.
ETTER E]\c[COMBINING ACUTE ACCENT]"
> "é"
>
> So Rakudo has to read the next codepoint to make sure that it isn't a
> combining codepoint.
>
> It is probably faking up the reads to look right when reading ASCII, but
> failing to do that for wider codepoints.
>
F-16 encoded
> strings:
>
> https://github.com/rakudo/rakudo/issues/3461
>
> I know it might be far-fetched, but what if your UTF-8 issue and
> Yary's UTF-16 issue were related? It would be nice to kill two birds
> with one stone.
>
> Best Regards, Bill.
>
>
>
>
> O
I was just posting that.
On 4/24/20, Elizabeth Mattijsen wrote:
>
>
>> On 24 Apr 2020, at 22:03, Joseph Brenner wrote:
>>
>> Thanks, yes I understand unicode and utf-8 reasonably well.
>>
>>> So Rakudo has to read the next codepoint to make sure
f I really wanted to
intermix readchars and seeks like this... I'd need to check the range
of the codepoint to see how far I need to seek to get where I expect
to be.
On 4/24/20, Joseph Brenner wrote:
> Thanks, yes I understand unicode and utf-8 reasonably well.
>
>> So Rakudo has to r
quot;
>
> So Rakudo has to read the next codepoint to make sure that it isn't a
> combining codepoint.
>
> It is probably faking up the reads to look right when reading ASCII, but
> failing to do that for wider codepoints.
>
> On Fri, Apr 24, 2020 at 1:34 PM Joseph Brenner wrote:
>
I thought that doing a readchars on a filehandle, seeking backwards
the width of the char in bytes and then doing another read
would always get the same character. That works for ascii-range
characters (1-byte in utf-8 encoding) but not multi-byte "wide"
characters (commonly 3-bytes in utf-8).
> Object hashes currently come with a performance penalty. That's why they are
> currently not the default.
Thanks, that makes sense.
On 4/6/20, Elizabeth Mattijsen wrote:
>> On 6 Apr 2020, at 07:19, Joseph Brenner wrote:
>>> If you want a Hash which allows any
>>
behavior wasn't
the default. Thanks much.
On 4/5/20, Tobias Boege wrote:
> On Sun, 05 Apr 2020, Joseph Brenner wrote:
>> I find in Raku that (as expected) I can use an object as a hash key:
>>
>> class Rutabaga { method color { say "purple (and white)"; } }
>&
I find in Raku that (as expected) I can use an object as a hash key:
class Rutabaga { method color { say "purple (and white)"; } }
my $obj = Rutabaga.new
my %vegeout;
%vegeout{ $obj } = "this works";
And for something I was doing I wanted to save up
data about matches for
or two. Sometimes it's about readability,
> sometimes about elegance. Overuse is surely bad, but overuse of anything is
> bad, for that matter. :)
>
> Best regards,
> Vadim Belman
>
>> On Mar 17, 2020, at 1:09 PM, Joseph Brenner wrote:
>>
>>> Though I've no
ce blob fingfangfoom tingler], rocks =>
> [marble sandstone granite chert pumice limestone]}
>
> Though I've no idea what those colons are/are not doing. And we can get to
> those "inner" array elements via
>> say %stash[1]
> sandstone
>
>
>
>
gt; my %stash = monsters => @monsters
>>>>> {monsters => [godzilla grendel wormface blob fingfangfoom tingler]}
>>>>> > %stash.append: (rocks => @rocks);
>>>>> {monsters => [godzilla grendel wormface blob fingfangfoom tingler],
>>
'}= @greek;
%stash.append: (:greek(@greek));
-- Forwarded message --
From: Joseph Brenner
Date: Mon, 16 Mar 2020 14:10:01 -0700
Subject: Re: stashing an array in a hash and yanking it back out
To: Vadim Belman
Vadim Belman wrote:
> So, you basically needed:
>
> my
William Michels wrote:
> Yes, since I was working in the REPL, I tried compacting Joe's code by
> eliminating the "my %stash" line at the top, and adding "my" to the third
> line.
I noticed the additional "my" in there, but I wouldn't have been able
to tell you why it was behaving like it
Timo Paulssen wrote:
> The reason for that is that `my %foo{Bar}` is syntax for restricting
> the keys of the hash to a specific type (by default it's `Str(Any)`)
Hm.. That's certainly useful, I hadn't even gotten to wondering how to
do that yet.
> and giving a string instance ("monsters"
There might not be much to say about this, I just though I'd
mention that I keep getting re-surprised by basics with Raku,
like this one, where first I stash an array away in a hash and
later try to pull the array out again:
my %stash;
my @monsters =
<< godzilla grendel wormface
ho_grk();
>>
>> my $obj2 = HasSubset.new( grk => << alpha beta gamma >> );
>> $obj2.echo_grk();
>>
>> my $obj3 = HasSubset.new( grk => << alpha beta rutabaga >> );
>> $obj3.echo_grk();
>> # value 'rutabaga' fails as expect
t; );
$obj3.echo_grk();
# value 'rutabaga' fails as expected:
# Type check failed in assignment to @!grk; expected
HasSubset::Allowed but got Str ("rutabaga")
On 1/12/20, Joseph Brenner wrote:
> Here's a code snippet that tries to use a subset to constrain the
> values of an
Here's a code snippet that tries to use a subset to constrain the
values of an object field (i.e. declared with has). As written, this
code works, but only when there's what looks like an irrelevant
experimental line in it (labeled "WEIRD ONE"), when that line is
commented out it throws an
This can be done with an explicit, named subset if you like:
subset StrOrInt where Str | Int;
sub do_stuff ( StrOrInt $item ) {
say "$item is a " ~ $item.^name;
}
On 1/9/20, ToddAndMargo via perl6-users wrote:
mailto:perl6-users@perl.org>> wrote:
Hi
I was just playing around with using a "subset" to restrict a
string to a set of allowed values:
subset Monster of Str where * eq any( << godzilla mothera blob
tingler grendel minotaur >> );
my Monster $thingie;
$thingie = 'grendel'; # accepts this as expected
$thingie = 'nada'; #
Joseph Brenner wrote:
> The signatures in the documentation are certainly helpful, but they're
> no substitute for code examples. I'd go after adding more code
> examples, rather than removing other stuff.
But then, maybe I'm coming into this discussion in the middle-- is the
topic he
The signatures in the documentation are certainly helpful, but they're
no substitute for code examples. I'd go after adding more code
examples, rather than removing other stuff.
}
>
> my @deck = 1..10;
> say pop-random @deck; # 7
> say @deck; # [1 2 3 4 5 6 8 9 10]
>
>
> On Sun, Dec 8, 2019 at 1:26 PM Joseph Brenner wrote:
>
>> What's the sub signature incantation to
>> pass-by-reference do you can act directly
>>
What's the sub signature incantation to
pass-by-reference do you can act directly
on the structure passed in without juggling
an alias yourself?
# deal from middle
my $card = pop_random( @deck );
Oh, you know, think I've spotted a source of confusion in this
thread... Liz-- I think my accident-- replied to me directly, and we
kept going talking about this without cc-ing the list. So yeah, I
pointed out there was a bug with the routine form of comb that wasn't
in the Str method, and she
expected 2 or 3 arguments but got 4
> in block at line 1
>
>> say comb(/\w+/, "a;b;c", 2, :True).perl;
> Unexpected named argument 'True' passed
> in block at line 1
>
>> $*VM
> moar (2019.07.1)
>
> Any help appreciated, Bill.
>
>
>
.comb(/./, :g, :match);
> (「f」 「o」 「o」 「b」 「a」 「r」)
>
>> On 10 Nov 2019, at 23:46, Joseph Brenner wrote:
>>
>> Can someone give me an example of how to use the comb routine to
>> return a list of match objects?
>>
>> The documentation here:
>>
>> ht
Can someone give me an example of how to use the comb routine to
return a list of match objects?
The documentation here:
https://docs.perl6.org/type/Str#routine_comb
Mentions a boolean option to get match objects:
> If $matcher is a Regex, each Match object is
> converted to a Str, unless
Thanks, that looks good. At the moment I was thinking about cases
where there's no need division by lines or words (like say,
hypothetically bioinformatics data: very long strings no line breaks).
On 10/20/19, Elizabeth Mattijsen wrote:
>> On 20 Oct 2019, at 23:38, Joseph Brenner wrote
is a text file, it would be `.comb(512)`
>
> On Sun, Oct 20, 2019 at 4:39 PM Joseph Brenner wrote:
>
>> I was just thinking about the case of processing a large file in
>> chunks of an arbitrary size (where "lines" or "words" don't really
>> work). I
Thanks, I'll take a look at that.
Brad Gilbert wrote:
> Assuming it is a text file, it would be `.comb(512)`
>
> On Sun, Oct 20, 2019 at 4:39 PM Joseph Brenner wrote:
>
>> I was just thinking about the case of processing a large file in
>> chunks of an arbitrary size
I was just thinking about the case of processing a large file in
chunks of an arbitrary size (where "lines" or "words" don't really
work). I can think of a few approaches that would seem kind-of
rakuish, but don't seem to be built-in anywhere... something like a
variant of "slurp" with an
Last I looked, raku.org redirects to perl6.org already.
On 10/15/19, Darren Duncan wrote:
> One of the earliest steps that I hope gets implemented as soon as possible
> is
> that the previous official web domain for Perl 6 which is *.perl6.org gets
> an
> official replacement such as *.raku.org
Just as a practical matter, I would expect it will be "Raku (the
language-formerly-known-as-Perl 6)" for some time.
I would call the vote among core developers "official", and Larry
Wall's approval makes it as solid as it can get.
On 10/15/19, JJ Merelo wrote:
> There's no such thing as a Raku
ng Perl 6.c.
>> >
>> > I'm a little puzzled, I'd've thought the loop around the 'my Int $y'
>> would redeclare a local $y each time. Instead it behaves like:
>> > $ time perl6 -e 'my Int $y = 0;for ( 1 .. 100) { $y += $_} ; say
>> $y; '
>> >
>> > (which
me perl6 -e 'my Int $y = 0;for ( 1 .. 100) { $y += $_} ; say $y; '
>
> (which is signficantly faster ;-)
> 5050
> real 0m1.229s
> user 0m1.254s
> sys 0m0.040s
>
> )
>
> From: Joseph Brenner
> Sent: Wednesday, September 25, 2019 1
ps
On 9/25/19, Joseph Brenner wrote:
> I just gave that one-liner a try, but I didn't see that error:
>
>> seq 100 | time perl6 -e 'say [+] lines'
> 5050
> 28.70user 0.07system 0:28.29elapsed 101%CPU (0avgtext+0avgdata
> 74188maxresident)k
> 63424inputs+0outp
I just gave that one-liner a try, but I didn't see that error:
> seq 100 | time perl6 -e 'say [+] lines'
5050
28.70user 0.07system 0:28.29elapsed 101%CPU (0avgtext+0avgdata
74188maxresident)k
63424inputs+0outputs (32major+15409minor)pagefaults 0swaps
perl6 --version
This is Rakudo
wrote:
> On Mon, Sep 2, 2019 at 1:12 AM Joseph Brenner wrote:
>
>> I was just trying to run Simon Proctor's solution, and I see it
>> working for Yary's first case, but not his more complex one with
>> problem characters like brackets included in the list of characters.
I was just trying to run Simon Proctor's solution, and I see it
working for Yary's first case, but not his more complex one with
problem characters like brackets included in the list of characters.
I don't really see how to fix it, in part because I'm not that
clear on what it's actually doing...
> If Perl had worked harder to stay in the public eye in a good way (rather
than being viewed as dieing), there wouldn't have been a perceived
need for Python.
As I remember it, there was a concerted attack on perl with Python
being held up as the-anti-perl. There wasn't (yet) any question of
I think:
(1) For a rename to happen, Larry Wall really has to sign off on it:
this is just a social reality of the perl world.
(2) The rename really has to be an announced, offical rename. It
can't be just an alias or a knickname or anything like that.
I find I like the name Camelia in part
ful:
No such method 'lines' for invocant of type 'IO::Special'
On 7/28/19, Bruce Gray wrote:
>
>
>> On Jul 28, 2019, at 6:20 PM, Joseph Brenner wrote:
>>
>> I was just wondering if there's some direct analog in perl6 to the
>> perl5 construct:
>>
>&g
I was just wondering if there's some direct analog in perl6 to the
perl5 construct:
while(<>){ ... }
If I'm planning on passing a filename on the command-line, I can just
get it out of $*ARGFILES easily enough, but what if I also wanted it
to work on lines passed in via standard input?
Brad Gilbert wrote:
> For one it has the following line:
>
> use lib 'lib';
>
> That is going to slow everything down if you have anything in the
> `lib` directory.
> The more things in that directory, the slower it will get.
I've been seeing some pretty slow perl6 one-line invocations,
ToddAndMargo via perl6-users wrote:
> David Christensen wrote:
>> We discussed this at our San Francisco Perl Mongers meeting today:
>
> Any Perl 5 guys there? And did they get "grouchy" with you
> for using Perl 6?
We've been doing an "Informal Perl6 Study Group" over at the Oakland
Museum
Just in case it wasn't clear from Bill's discussion, I think the
reason this case seems weird is normally we expect trailing separators
to be ignored, as with the extra comma here:
> my @monsters = ('ghidora', 'mothera', 'wolfman', 'zuckerberg',);
[ghidora mothera wolfman zuckerberg]
If you
.
>
> -y
>
>
> On Sun, Apr 14, 2019 at 10:29 AM Joseph Brenner wrote:
>
>> Richard Hainsworth wrote:
>> > A semicolon is the syntax used for multidimensional arrays.
>> >
>> > See https://docs.perl6.org/language/subscripts#Multiple_dimensions
&g
How do you write code that detects whether it's running under the repl?
uot; (does an augment on Any)
^
|
Augment::Util-- "recompose_core": propagate changes from an augment
^
|
Symbol::Scan -- "list_core_type_objects": find everything in core
On 11/4/18, Joseph Brenner wrote:
> I pushed out the perl6 code I've been working on to git
I pushed out the perl6 code I've been working on to github and CPAN.
I sub-divided it into four parts with a dependency tree like so:
Symbol::Scan
|
Object::Examine Augment::Util
||
|/
|
I've got a weird one here... a line that looks like it does
nothing significant is needed for the code to work.
If the line below marked "The Mystery Line" is commented out,
you just get the error:
===SORRY!===
Cannot look up attributes in a VMNull type object
Augment::Util:
class
yZero
Thanks. I didn't get that the behavior of WHAT and ^name were that different.
> On Mon, Oct 29, 2018 at 1:04 PM Joseph Brenner wrote:
>
>> I was just looking into doing some finer-grained exception handling,
>> so I tried this:
>>
>>use v6;
>>
I was just looking into doing some finer-grained exception handling,
so I tried this:
use v6;
try {
my $result = 4/0;
say "result: $result";
CATCH {
#when DivideByZero { say "Oh, you know."; }
default { say .WHAT; .Str.say } # (DivideByZero)
By the way, I'd really like to know what the vertical bar is here in
front of "CORE":
> for (|CORE::) .grep({ .key eq .value.^name }) .map( *.value ) -> $class {
It's not the "any" junction, is it? How would that make sense here?
On 10/19/18, Joseph Brenner
e cases where it does matter (although I can’t
> think of one right now).
>
>
> Liz
>
>> On 19 Oct 2018, at 21:14, Joseph Brenner wrote:
>>
>> Okay, good enough... if I can't slip my changes in ahead of
>> everything then reinitializing everything viz ^compose
jsen wrote:
> See also:
> https://stackoverflow.com/questions/52718499/how-to-correctly-augment-any
>
>> On 19 Oct 2018, at 03:52, Joseph Brenner wrote:
>>
>> I've got another question about aug--yes, I know--ment.
>>
>> I've got a module ides_of_augment.pm6:
&g
I've got another question about aug--yes, I know--ment.
I've got a module ides_of_augment.pm6:
use MONKEY-TYPING;
augment class Any {
method hiccup {
say "hic!";
}
}
I would've thought it could be used in the repl like this:
perl6 -Mides_of_augment
>
not with "zef install
".
Maybe some sort of permissions issue with a LTA error message?
On 10/16/18, Todd Chester via perl6-users wrote:
> On 10/16/18 8:20 PM, Joseph Brenner wrote:
>> Lately zef hasn't been working for me to do module installation.
>> I can do thin
Lately zef hasn't been working for me to do module installation.
I can do things like "zef --list" to get a list of available
modules but when I actually try to do the installation I see
things like this:
zef install Array::Agnostic
===> Searching for: Array::Agnostic
===> Testing:
Elizabeth Mattijsen wrote:
>> Joseph Brenner wrote:
>> Would anyone happen to know if there's a duckduckgo trick to get just
>> perl6 links and not perl5?
>>
>> If you just append "perl6" it'll be mostly perl6 info in the top ten,
>> but th
Would anyone happen to know if there's a duckduckgo trick to get just
perl6 links and not perl5?
If you just append "perl6" it'll be mostly perl6 info in the top ten,
but there tends to be at least some perl5 intermixed in it.
Thanks, yes that's one of the first approaches I looked at, but there's
still that extra "does" step before you can say $x.tellall;
On Sat, Sep 22, 2018 at 2:39 PM, Curt Tilmes wrote:
> On Sat, Sep 22, 2018 at 5:30 PM Larry Wall wrote:
>
>> On Sat, Sep 22, 2018 at 11
Larry Wall wrote:
> Joseph Brenner wrote:
>> Sounds good, thanks.
> Well, yes, *sounds* good. :-)
> Monkey patching is allowed but discouraged in Perl 6, because Ruby.
But I *like* being evil.
But as I was trying to make clear, it's not something I'm planning on
usin
gt; org/syntax/augment.html
>
> On Sat, Sep 22, 2018 at 2:33 PM Joseph Brenner wrote:
>
>> I was just wondering if there's any way to extend an existing
>> class in perl 6. I'd like to be able to do things like drop
>> a custom debugging method in Any that would
I was just wondering if there's any way to extend an existing
class in perl 6. I'd like to be able to do things like drop
a custom debugging method in Any that would then be available
on everything.
Note: I'm talking about adding something to an existing class
("monkeypatching") as opposed to
> they were all just subs.
With perl5 code, I've gravitated to talking about "routines" when I don't
want to worry about whether something is technically a function or a
method. It doesn't seem to confuse anyone. (On the other hand, I've had
people make fun of me for using the word
t;
> https://docs.perl6.org/routine/methods
>
> On 2018-07-31 06:56:07 +0430, Joseph Brenner wrote:
>> I originally thought that $var.^methods gave you a list of all
>> available methods on $var, but it looks like it doesn't (always?)
>> report on inherited methods.
>>
I originally thought that $var.^methods gave you a list of all
available methods on $var, but it looks like it doesn't (always?)
report on inherited methods.
my $stringy = '3.14159';
say $stringy.^name;
# Str
say $stringy.^mro;
# ((Str) (Cool) (Any) (Mu))
The list returned from checking
) (Mu))
On Sun, Jul 29, 2018 at 10:42 AM, Laurent Rosenfeld
wrote:
> Hi,
>
> Try this:
>
>
> my $stringy = "abc";
> say $stringy.^parents(:all);
>
> This should display:
>
> ((Cool) (Any) (Mu))
>
> Cheers,
> Laurent.
>
> 2018-07-29 19:2
If you look at the type diagram:
https://docs.perl6.org/type/Str#___top
You can see that:
Str is Cool is Any is Mu
But if you use the ^parents method on a string, you don't get
"Cool", instead you get "()":
my $stringy = "abc";
say $stringy.^name; # Str
say
ns 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, Jos
Attention conservation: it's unlikely I'm going to say something
interesting you haven't thought of already.
A side-discussion that came up here: should you ask questions here, or
at stackoverflow (or both here *and* at stackoverflow).
I understand the argument that it's better to talk about
of "but" in the objects docs to be
tremendously confusing at first: it looks like some sort of
conditional check, like "unless".
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
12, 2018 at 12:09 AM, JJ Merelo wrote:
> 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 cop
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:
201 - 300 of 300 matches
Mail list logo