Super! That's what i was looking for.
Thanks!
David Santiago
Às 18:43 de 17/01/22, Clifton Wood escreveu:
You need the method object, and you can't get that from $a.test --
Try using the following:
when X::AdHoc {
say $a.^lookup('test').WHY; # TODO: This is wrong :-(
}
I've tested
You need the method object, and you can't get that from $a.test --
Try using the following:
when X::AdHoc {
say $a.^lookup('test').WHY; # TODO: This is wrong :-(
}
I've tested it here (
https://replit.com/@Xliff/ThinDutifulExtensions#main.raku)
and it works!
:)
-X
On Mon, Jan 17, 2022 at 12
Hello Rakuns,
How do i access the declarator block of my object method?
I'm trying to do this, but it's not working:
class A {
#|( This is just a test with 3 parameters:
* p1 - parameter 1
* p2 - parameter 1
* p2 - parameter 1
)
method test($p1, $p2, $p3
Jo,
For what its worth, the search page on http://raku.finanalyst.org now
takes you to ^methods
Previously, a search on '^methods' found the reference, but hide the
location, so the link could not be clicked. That is fixed now.
Regards,
Richard
On 10/03/2021 15:42, Joseph Brenner wrote:
JJ Merelo wrote:
> This is a bug in Documentable. Generated an issue there
> https://github.com/Raku/Documentable/issues/149 Thanks for the report.
And thanks for opening the issue.
This is a bug in Documentable. Generated an issue there
https://github.com/Raku/Documentable/issues/149 Thanks for the report.
t; On Tue, Mar 2, 2021 at 8:12 PM Joseph Brenner wrote:
> >
> > If you go to docs.raku.org and type "^methods" into the search
> > window, you get a drop down looking something like this:
> >
> > class
> > Method
> > Submeth
Please open an issue for this at github.com/Raku/doc/issues
On Tue, Mar 2, 2021 at 8:12 PM Joseph Brenner wrote:
>
> If you go to docs.raku.org and type "^methods" into the search
> window, you get a drop down looking something like this:
>
> class
>
If you go to docs.raku.org and type "^methods" into the search
window, you get a drop down looking something like this:
class
Method
Submethod
method
methods
Reference
^methods
methods
Submethods
Routine
method
S
4 : to put into effect or operation : implement
5 : bring about, cause"
2,3,4 and possibly even #5 relate to methods.
Simply referring to a method by name, like .rand invokes it directly.
Giving it a value (24.cos) is closer to #3 ("please give me this
value"), and it do
ement
5 : bring about, cause"
2,3,4 and possibly even #5 relate to methods.
Simply referring to a method by name, like .rand invokes it directly.
Giving it a value (24.cos) is closer to #3 ("please give me this
value"), and it doesn't matter whether that's a literal or gener
of code is doing.
So, would you say you now understand that `.value` is a
method call on an "invocant" that is either explicitly written
to the left of the `.` or is implicitly whatever the current topic
is where the `.value` appears?
No idea since you hinted to a newbie like myself.
On 12/19/20 11:04 PM, ToddAndMargo via perl6-users wrote:
Hi All,
https://github.com/rakudo/rakudo/blob/master/src/core.c/Str.pm6
337:multi method contains(Str:D: Str:D $needle --> Bool:D) {
338:nqp::hllbool(nqp::isne_i(nqp::index($!value,$needle,0),-1))
339:}
I "presume" in
I won't explain it for now, but rather just try
to confirm you now know what that bit of code is doing.
So, would you say you now understand that `.value` is a
method call on an "invocant" that is either explicitly written
to the left of the `.` or is implicitly whatever the current topic
i
e a `.value`, only a `$!value`. But if I did, and had that
sort of name, it would typically be a method call that returns an
attribute of the same name -- like `$!value`.
Is this .self with a better name?
3) the first "Str:D" goes to what on line 337? To .value?
No, to the invocant
>2) where is variable ".value" defined on line 338?
>What kind of variable is .value?
I don't see a `.value`, only a `$!value`. But if I did, and had that
sort of name, it would typically be a method call that returns an
attribute of the same name -- like `$!value`.
>
On 12/20/20 5:01 AM, ToddAndMargo via perl6-users wrote:
On 12/20/20 2:24 AM, ToddAndMargo via perl6-users wrote:
Hi All,
Now what am I doing wrong?
-T
class Angle {
# has num64 $.degrees;
method AngleCosine( Rat:D: --> Rat:D ) {
my Numeric $radians = sel
On 12/20/20 2:24 AM, ToddAndMargo via perl6-users wrote:
Hi All,
Now what am I doing wrong?
-T
class Angle {
# has num64 $.degrees;
method AngleCosine( Rat:D: --> Rat:D ) {
my Numeric $radians = self*π/180;
print "self = <&qu
On 12/19/20 8:21 PM, Bruce Gray wrote:
With a custom `new` method, that could be shortened further to:
say BadMath.new(2, 2).BadAdd;
print BadMath.new(2, 2).BadAdd ~ "\n";
Default constructor for 'BadMath' only takes named arguments
in block at line 1
What am I missing?
Hi All,
https://github.com/rakudo/rakudo/blob/master/src/core.c/Str.pm6
337:multi method contains(Str:D: Str:D $needle --> Bool:D) {
338:nqp::hllbool(nqp::isne_i(nqp::index($!value,$needle,0),-1))
339:}
I "presume" in
"abcd".contains("bc")
"abcd&qu
On 12/19/20 8:21 PM, Bruce Gray wrote:
On Dec 19, 2020, at 6:40 PM, ToddAndMargo via perl6-users
wrote:
Hi All,
I have so far:
class BadMath {
has Int $.A;
has Int $.B;
method BadAdd() {
my $Clinker = (-5..5).rand.truncate;
return $!A + $!B
> On Dec 19, 2020, at 6:40 PM, ToddAndMargo via perl6-users
> wrote:
>
> Hi All,
>
> I have so far:
>
>
> class BadMath {
> has Int $.A;
> has Int $.B;
>
> method BadAdd() {
> my $Clinker = (-5..5).rand.trunca
Hi All,
I have so far:
class BadMath {
has Int $.A;
has Int $.B;
method BadAdd() {
my $Clinker = (-5..5).rand.truncate;
return $!A + $!B + $Clinker;
}
}
my $TwoPlusTwo = BadMath.new( A => 2, B=> 2 );
print $TwoPlusTwo.BadAdd
On 2020-06-08 16:08, Peter Pentchev wrote:
Yes, I know. Git does take some getting used to; any program does. With
time, you may find it useful.
The things you do all the time, you remember. Since
I am IT support to small business and do EVERYTHING,
except the wiring, which I have guys that
On Mon, Jun 08, 2020 at 04:01:41PM -0700, ToddAndMargo via perl6-users wrote:
> On 2020-06-08 15:35, Peter Pentchev wrote:
> > On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users
> > wrote:
> > > On 2020-06-08 15:02, Peter Pentchev wrote:
> > > > On Mon, Jun 08, 2020 at
On 2020-06-08 15:35, Peter Pentchev wrote:
On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users wrote:
On 2020-06-08 15:02, Peter Pentchev wrote:
On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote:
On 2020-06-08 14:54, Peter Pentchev wrote:
On Mon,
On Mon, Jun 08, 2020 at 03:15:36PM -0700, ToddAndMargo via perl6-users wrote:
> On 2020-06-08 15:02, Peter Pentchev wrote:
> > On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users
> > wrote:
> > > On 2020-06-08 14:54, Peter Pentchev wrote:
> > > > On Mon, Jun 08, 2020 at
On 2020-06-08 15:02, Peter Pentchev wrote:
On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote:
On 2020-06-08 14:54, Peter Pentchev wrote:
On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote:
On 2020-06-08 13:55, Richard Hainsworth wrote:
On Mon, Jun 08, 2020 at 02:57:58PM -0700, ToddAndMargo via perl6-users wrote:
> On 2020-06-08 14:54, Peter Pentchev wrote:
> > On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users
> > wrote:
> > > On 2020-06-08 13:55, Richard Hainsworth wrote:
> > [snip]
> > > > The opening
On 2020-06-08 14:57, ToddAndMargo via perl6-users wrote:
On 2020-06-08 14:54, Peter Pentchev wrote:
On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users
wrote:
On 2020-06-08 13:55, Richard Hainsworth wrote:
[snip]
The opening bracket for class Informing is on (or about) line
On 2020-06-08 14:54, Peter Pentchev wrote:
On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote:
On 2020-06-08 13:55, Richard Hainsworth wrote:
[snip]
The opening bracket for class Informing is on (or about) line 10 and the
closing in at about line 630, with a comment
On Mon, Jun 08, 2020 at 02:48:48PM -0700, ToddAndMargo via perl6-users wrote:
> On 2020-06-08 13:55, Richard Hainsworth wrote:
[snip]
> > The opening bracket for class Informing is on (or about) line 10 and the
> > closing in at about line 630, with a comment 'end of Informing class'
> >
> >
On 2020-06-08 14:43, Mark Devine wrote:
Peter,
I applaud your excellent assistance with Raku. Et. al. (you know the names)...
Outstanding community!
Mark
He is a force of nature, as are many on this list.
On 2020-06-08 13:55, Richard Hainsworth wrote:
Todd,
The 'unit' in line 3 means something like 'this whole file is the
Module' so there are no Begins/Ends/brackets.
Poop. I spaced on that. I start all my moduels with
1: unit module ;
The opening bracket for class Informing is on (or
allowed to use.
> > > >
> > > > In Raku, if you develop a new type, for example say a quodion, and you
> > > > want to 'add' quodions, then you CAN use + because it can be overloaded.
> > > > It is defined as a multi.
> > > >
> >
Peter,
I applaud your excellent assistance with Raku. Et. al. (you know the names)...
Outstanding community!
Mark
-Original Message-
From: Peter Pentchev
Sent: Monday, June 8, 2020 17:13
To: perl6-us...@perl.org
Subject: Re: question about the multi in method
On Mon, Jun 08, 2020
most overused example 'needle' can be rewritten to take a
quodion, which may yield a spectrum of results because that's what
quodions are for.
Since needle is defined as a 'multi', if you write a 'needle' method for
quodions, the needle for strings STILL exists, and Raku will correctly
call
evelop a new type, for example say a quodion, and you
> > want to 'add' quodions, then you CAN use + because it can be overloaded.
> > It is defined as a multi.
> >
> > Or in your most overused example 'needle' can be rewritten to take a
> > quodion, which may yield
he module you mentioned are methods of the
Informative::Informing class. You can check it by matching the '{' at
the beginning of the class declaration with the corresponding '}';
method show() is inside the class.
OTOH there's a "sub inform" in the "Informative" namespace whi
entioned are methods of the
Informative::Informing class. You can check it by matching the '{' at
the beginning of the class declaration with the corresponding '}';
method show() is inside the class.
OTOH there's a "sub inform" in the "Informative" namespace which is not
inside a class
On 2020-06-08 08:05, Peter Pentchev wrote:
On Mon, Jun 08, 2020 at 10:45:21AM +0100, Richard Hainsworth wrote:
Ok Todd, let me have a go at this issue.
Thank you, Richard, for your help. I apologize to Todd and to everyone
on the list for my outburst in my last e-mail.
G'luck,
Peter
Hi
because that's what
quodions are for.
Since needle is defined as a 'multi', if you write a 'needle' method for
quodions, the needle for strings STILL exists, and Raku will correctly
call the method you wrote for quodions if a quodion is implied, but call
the default needle if a string (or any other
On Mon, Jun 08, 2020 at 10:45:21AM +0100, Richard Hainsworth wrote:
> Ok Todd, let me have a go at this issue.
Thank you, Richard, for your help. I apologize to Todd and to everyone
on the list for my outburst in my last e-mail.
G'luck,
Peter
--
Peter Pentchev r...@ringlet.net r...@debian.org
ods in the module.
>
> I am confused.
Methods are just subroutines which take an implicit first argument: the
object they are operating on.
All the methods in the module you mentioned are methods of the
Informative::Informing class. You can check it by matching the '{' at the
beginning of the cla
On 2020-06-08 04:32, Fernando Santagata wrote:
On Mon, Jun 8, 2020 at 1:20 PM ToddAndMargo via perl6-users
mailto:perl6-us...@perl.org>> wrote:
On 2020-06-08 03:38, Fernando Santagata wrote:
> …and line 3:
>
> unit module Informative;
>
3: unit module
On Mon, Jun 8, 2020 at 1:20 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> On 2020-06-08 03:38, Fernando Santagata wrote:
> > …and line 3:
> >
> > unit module Informative;
> >
>
>
> 3: unit module Informative;
>
> Does not look like a class to me. What am I missing?
>
It's
er/lib/Informative.pm6
Line 144:
method show(
Str $str?,
Int :$timer,
Bool :$show-countdown
) {
where is the class that is linked to that method?
Many thanks,
-T
On 2020-06-08 03:38, Fernando Santagata wrote:
> …a
>> Hi All,
>>
>> Over on
>>
>> https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6
>>
>> Line 144:
>>
>> method show(
>> Str $str?,
>> Int :$timer,
>> Bool
finanalyst/p6-inform/blob/master/lib/Informative.pm6
>
> Line 144:
>
> method show(
> Str $str?,
> Int :$timer,
> Bool :$show-countdown
> ) {
>
> where is the class that is linked to that method?
>
> Many thanks,
> -T
>
>
--
Fernando Santagata
Look at line 10
class Informing {
On 08/06/2020 11:31, ToddAndMargo via perl6-users wrote:
Hi All,
Over on
https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6
Line 144:
method show(
Str $str?,
Int :$timer,
Bool :$show
Hi All,
Over on
https://github.com/finanalyst/p6-inform/blob/master/lib/Informative.pm6
Line 144:
method show(
Str $str?,
Int :$timer,
Bool :$show-countdown
) {
where is the class that is linked to that method?
Many thanks,
-T
is defined as a 'multi', if you write a 'needle' method for
quodions, the needle for strings STILL exists, and Raku will correctly
call the method you wrote for quodions if a quodion is implied, but call
the default needle if a string (or any other type) is used.
Since you have developed
On Mon, Jun 8, 2020 at 10:15 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> On 2020-06-08 00:48, Fernando Santagata wrote:
> > On Mon, Jun 8, 2020 at 9:12 AM ToddAndMargo via perl6-users
> > mailto:perl6-us...@perl.org>> wrote:
> >
> > On 2020-06-07 22:39, Peter Pentchev wrote:
ameters? Was that not written in
> > the documentation? Or that you may call .starts-with() with a $needle
> > being Cool and not Str? Again, was that not written in the
> > documentation? So what did you learn from going to Github that was not
> > in the documentation?
On 2020-06-08 00:48, Fernando Santagata wrote:
On Mon, Jun 8, 2020 at 9:12 AM ToddAndMargo via perl6-users
mailto:perl6-us...@perl.org>> wrote:
On 2020-06-07 22:39, Peter Pentchev wrote:
I addressed this in my original e-mail: the documentation is
currently:
1. a reference manual
Targets
On Mon, Jun 8, 2020 at 9:12 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> On 2020-06-07 22:39, Peter Pentchev wrote:
> > I addressed this in my original e-mail: the documentation is currently:
> > 1. a reference manual
>
> Targets at what audience?
>
I think that that point
On 2020-06-07 22:39, Peter Pentchev wrote:
I thought I explained that. The Rakudo developers are*never* finished
with the development of some methods. Somebody*will* want to extend
them in their own module. The Rakudo developers*want* to declare some
methods as "multi" to allow the Rakudo
; > On Sun, Jun 07, 2020 at 09:04:45AM -0500, Brad Gilbert wrote:
> > > > > On Sun, Jun 7, 2020 at 3:15 AM ToddAndMargo via perl6-users <
> > > > > perl6-us...@perl.org> wrote:
> > > > >
> > > > > > Hi All,
rl6-us...@perl.org> wrote:
Hi All,
Dumb question:
Does the "multi" in "multi method" mean there
is more than one way to address a method?
Or, are the all methods "multi methods".
If not and the method is a multi, should not the
documentation show all (more than
On Sun, Jun 7, 2020 at 3:15 AM ToddAndMargo via perl6-users <
> > > > perl6-us...@perl.org> wrote:
> > > >
> > > > > Hi All,
> > > > >
> > > > > Dumb question:
> > > > >
> > > > > Does th
t; perl6-us...@perl.org> wrote:
> > >
> > > > Hi All,
> > > >
> > > > Dumb question:
> > > >
> > > > Does the "multi" in "multi method" mean there
> > > > is more than one way to
On 2020-06-07 08:29, Veesh Goldman wrote:
I imagine they called it cool because it, indeed, is cool.
The Raku developers do have a sense of humor. Cool,
needle, slurp, spurt: someone had a good laugh.
:-)
On 2020-06-07 08:19, Peter Pentchev wrote:
On Sun, Jun 07, 2020 at 09:04:45AM -0500, Brad Gilbert wrote:
On Sun, Jun 7, 2020 at 3:15 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
Hi All,
Dumb question:
Does the "multi" in "multi method" mean
M ToddAndMargo via perl6-users <
> > > perl6-us...@perl.org> wrote:
> > >
> > > > Hi All,
> > > >
> > > > Dumb question:
> > > >
> > > > Does the "multi" in "multi method
t; >
> > > Dumb question:
> > >
> > > Does the "multi" in "multi method" mean there
> > > is more than one way to address a method?
> > >
> > > Or, are the all methods "multi methods".
> > >
>
On Sun, Jun 07, 2020 at 09:04:45AM -0500, Brad Gilbert wrote:
> On Sun, Jun 7, 2020 at 3:15 AM ToddAndMargo via perl6-users <
> perl6-us...@perl.org> wrote:
>
> > Hi All,
> >
> > Dumb question:
> >
> > Does the "multi" in "multi met
There are four different types of a function. (both method and sub)
- `multi`
- `proto`
- `only`
- `anon`
A `proto` function is mainly just to declare there will be multiple
functions with same name.
`multi` is short for "multiple", meaning more than one.
`only` is the default
Hi All,
Dumb question:
Does the "multi" in "multi method" mean there
is more than one way to address a method?
Or, are the all methods "multi methods".
If not and the method is a multi, should not the
documentation show all (more than one) the ways of
addressin
On 2020-05-25 14:00, Brad Gilbert wrote:
In the following the 「:」 makes it so you don't need parenthesis
You have created a monster!
> my $s="a:c"; say $s.index: ":"
1
:-)
Version
<5 2 1 33 22>.sort( ).Version( )
Which sorts using the default sort.
The result is a Seq.
Then it tries to call a method named Version on that Seq.
On Mon, May 25, 2020 at 4:41 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> >> On Mon, May 25,
pace?
3) What does the `*` do?
4) Is the dot before Version mean something other
than .Version being a method?
Yours in confusion,
-T
On 2020-05-25 14:00, Brad Gilbert wrote:
In the following the 「:」 makes it so you don't need parenthesis
(…).sort: …
(…).
In the following the 「:」 makes it so you don't need parenthesis
(…).sort: …
(…).sort(…)
The reason there needs to be a space is so it isn't confused for an adverb.
「*.Version」 is a method call turned into a lambda.
Basically it creates a lambda where the only thing it does is call
getting the alpha, beta, and
release candidate thing down, I do not understand:
.sort: *.Version
1) What does the `:` do?
2) Why the space?
3) What does the `*` do?
4) Is the dot before Version mean something other
than .Version being a method?
Yours in confusion,
-T
cat foo.rakumod
unit module foo;
use Test;
$ raku -I . -e "use foo"
===SORRY!=== Error while compiling -e
===SORRY!=== Error while compiling /home/kb/foo.rakumod (foo)
No such method 'prefix' for invocant of type 'Capture'
at /home/kb/foo.rakumod (foo):2
at -e:1
$
Interestingly
$ by itself is a an anonymous state variable.
So these two lines would be exactly the same.
$.foo
(state $).foo
A feature was added where $.foo would instead be used for public attributes.
Since a public attribute just adds a method, it was allowed to use it to
call any method.
Which
Hello Vadim, Yary,
Thanks for your feedback,
I've filed an issue: https://github.com/rakudo/rakudo/issues/3306
Yary, about the dollar sign,
The snippet of code in the issue shows that expression "$.attribute" inside
a method 'just works' for accessing individual attributes
I would say filing an issue might make sense in this case. Here is a related
comment from Jonathan:
https://github.com/rakudo/rakudo/issues/3222#issuecomment-539915286 – and it
explicitly states that $. is a shortcut for method calling. Therefore, use of
colon instead of braces should
o GitHub
>
> On Sat, Nov 16, 2019 at 5:29 AM Raymond Dresens
> wrote:
>
>> Hello,
>>
>> I have a question related to the 'colon syntax' of Raku, which allows
>> you to call methods without parenthesis like this:
>>
>> class Foo
>> {
>>
looks like a bug to me-file an issue on the rakudo GitHub
On Sat, Nov 16, 2019 at 5:29 AM Raymond Dresens
wrote:
> Hello,
>
> I have a question related to the 'colon syntax' of Raku, which allows
> you to call methods without parenthesis like this:
>
> class Foo
>
Hello,
I have a question related to the 'colon syntax' of Raku, which allows
you to call methods without parenthesis like this:
class Foo
{
method print($x, $y)
{
say "bar: {$x}, {$y}"
}
}
my $a = Foo.new;
$a.p
Easy for you to say... (haha)
Nice! Many thanks.
Mark
From: Vadim Belman
Sent: Sunday, September 8, 2019 21:32
To: Mark Devine
Cc: perl6-users
Subject: Re: Wrap an attribute’s ^get_value method in TWEAK
Here is a quickly hacked together example:
multi trait_mod: (Attribute:D
Here is a quickly hacked together example:
multi trait_mod: (Attribute:D $a, :$xmlattr!) {
my $mname = $a.name.substr(2);
my = my method { say "ATTR($mname):", my \val = $a.get_value(self);
val };
_name($mname);
$a.package.^add_method($mname, );
}
class Foo {
intuition has expired.
my role XML-attribute {
has $attr;
method get_value () {
say 'in XML-attribute method get_value with ' ~ $.name;
$attr;
}
method set_value ($) {
say 'in XML-attribute method set_value with ' ~ $.name;
$attr = $;
}
}
multi sub
Hi Mark,
get_value won't give you what you expect. It's use is narrowly limited to trait
'is handles' and method .perl. Besides, are you sure all of your attributes
will be considered as belonging to XML? I mean, won't there be need for utility
attributes serving exclusively internal needs
Perl6 Community,
How do I properly wrap an attribute’s ^get_value method in TWEAK? If a
condition exists, I’d like to wrap all (:local) attributes so that they can do
some extra work.
The module that I’m working on has classes/attributes for hundreds of fields in
dozens of different, big XML
You got the order of operations wrong.
Method calls happen before prefix operators
These are identical
+@a.so
+(@a.so)
@a.so.Numeric
@a.Bool.Numeric
+?@a
As are these
+«@a».so
+«(@a».so)
@a».so».Numeric
@a».Bool».Numeric
+«?«@a
Postfix operators also
Hi Richard,
I don't think it's a bug. In:
put +@a.so;
the @a array is coerced into a Boolean value (True) by the so method, and
the resulting Boolean value is then coerced into an integer by the +
operator.
Cheers, Laurent.
Le ven. 21 déc. 2018 à 09:28, Richard Hainsworth a
écrit
A snippet:
my @a = 1..10;
put +@a.so; # output 1
put so(+@a); # output True
put (+@a).so; # output True
This caught me because I used +@s.so when I tried to do something like:
# in a class with 'has Bool $.pass;'
return unless ( $!pass = +@a.so );
# fails with a
like you expect
>>> is that it is passed strings.
>>
>>
>> Thank you!
>> I could have inferred that from the declaration of the 'test' argument here
>> https://docs.perl6.org/routine/dir where the test is being done against '.'
>> and '..', two strings:
>>
.org/routine/dir where the test is being done
>>> against '.' and '..', two strings:
>>>
>>> subdir(Cool $path = '.', Mu :$test = none('.', '..'))
>>>> method dir(IO::Path:D: Mu :$test = none('.', '..'))
>>>>
>>>
>>> but I guess i
> { .IO.d })` doesn't work like you expect
>>> is that it is passed strings.
>>>
>>
>> Thank you!
>> I could have inferred that from the declaration of the 'test' argument
>> here https://docs.perl6.org/routine/dir where the test is being done
>> against '.' and '..'
e inferred that from the declaration of the 'test' argument
> here https://docs.perl6.org/routine/dir where the test is being done
> against '.' and '..', two strings:
>
> subdir(Cool $path = '.', Mu :$test = none('.', '..'))
>> method dir(IO::Path:D: Mu :$test = none('.', '..'))
ere the test is being done against '.'
and '..', two strings:
subdir(Cool $path = '.', Mu :$test = none('.', '..'))
> method dir(IO::Path:D: Mu :$test = none('.', '..'))
>
but I guess it's a long stretch.
Maybe a note in the docs would be useful to others.
> I would argue tha
The reason `dir('a', test => { .IO.d })` doesn't work like you expect
is that it is passed strings.
> dir('a', test => {.say});
.
c
b
..
("a/.".IO "a/c".IO "a/b".IO "a/..".IO)
So `.IO.d` is looking to see if the CWD directory had a directory of
that name, not the `a`
, Nov 25, 2018 at 1:52 AM Timo Paulssen wrote:
>
>> The dir method gives you entries in the directory you pass. If you don't
>> pass a test it'll use the default test which is none(".", ".."), i.e.
>> "anything except . and ..".
>>
>> I'm
Here's output of 'a/b'.IO.d from the REPL:
> 'a/b'.IO.d
True
On Sun, Nov 25, 2018 at 1:52 AM Timo Paulssen wrote:
> The dir method gives you entries in the directory you pass. If you don't
> pass a test it'll use the default test which is none(".", "..&qu
The dir method gives you entries in the directory you pass. If you don't
pass a test it'll use the default test which is none(".", ".."), i.e.
"anything except . and ..".
I'm not sure why using { .IO.d } as the test would not give you b,
though. Can you check
Hello,
I think that I don't understand how the 'test' argument of 'dir' works.
I have a directory 'a', which contains a subdirectory 'b' and a file 'c'; I
want to select only the subdirectories of 'a'.
Using the REPL I tried to ask the content of the directory 'a':
> my @dirs = dir('a')
On 09/14/2018 04:33 PM, Ralph Mellor wrote:
multi method kv ...
Use of `multi` means there *may* be more than one *declaration* using
the same declared routine name (`kv` in this case). There usually *will*
be more than one. (Otherwise, why was it declared `multi`?)
The normal
> multi method kv ...
Use of `multi` means there *may* be more than one *declaration* using the
same declared routine name (`kv` in this case). There usually *will* be
more than one. (Otherwise, why was it declared `multi`?)
The normal way to *use* a routine is to call it.
If you decl
1 - 100 of 1684 matches
Mail list logo