On 9/26/18 6:19 PM, The Sidhekin wrote:
On Thu, Sep 27, 2018 at 2:49 AM ToddAndMargo <toddandma...@zoho.com
<mailto:toddandma...@zoho.com>> wrote:
On 9/26/18 4:33 PM, The Sidhekin wrote:
> On Wed, Sep 26, 2018 at 11:40 PM ToddAndMargo
<toddandma...@zoho.com <mailto:toddandma...@zoho.com>
> <mailto:toddandma...@zoho.com <mailto:toddandma...@zoho.com>>> wrote:
> And where is it stated what goes in the () and what goes
> in the []?
>
>
> The () is part of a method call syntax; method arguments go
there:
> https://docs.perl6.org/language/syntax#Subroutine_calls
Where does it state that
$ p6 '"a b c d e".words(3).say;'
(a b c)
means the first three words, starting at zero?
https://docs.perl6.org/routine/words#class_Str says it returns "the same
as a call to |$input.comb( / \S+ /, $limit )| would".
https://docs.perl6.org/routine/comb#class_Str says it "returns a list of
non-overlapping matches limited to at most |$limit| matches".
It doesn't say it returns the first such matches; maybe it should.
It doesn't say "starting at zero", but then, why should it? The
first three wouldn't be the first three if it skipped any, right?
> The [] is a postcircumfix operator; index arguments go there:
> https://docs.perl6.org/language/operators#postcircumfix_[_]
Where does
multi method words(Str:D $input: $limit = Inf --> Positional)
state that I can do such?
It doesn't.
https://docs.perl6.org/language/operators#postcircumfix_[_] does.
I ask this because not all methods will take []
Sure they will. They might give you runtime errors, if the method
doesn't (at runtime) return something that does Positional, but they
will all take it.
Also, where is it stated that
$ p6 '"a b c d e".words(3)[ 2, 4 ].say;'
(c Nil)
will send the first three words to [2,4] ?
It doesn't. It shouldn't: There's no "sending".
https://docs.perl6.org/language/operators#postcircumfix_[_] tells you it
calls postcircumfix:<[ ]> with a first argument of what the returned
(the first three words) and the remaining positional arguments 2, 4.
Eirik
Hi Eirek,
Curt Explained it to me. Thank you for all the help!
The only thing I am hanging on is "$limit = Inf"
-T
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~