Re: words[] question

2018-09-26 Thread Brian Duggan
On Tuesday, September 25, Todd Chester wrote: > Not to ask too obvious a question, but why does words use a [] > instead of a () ? > ... > I am confused as to when to use [] and when to use () with a method. If a method is called without arguments, the () can be omitted. "a man a plan a

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
You're imposing a shape on this, then getting angry at us when it turns out to be wrong. I'm sorry nobody could read your mind ahead of time to find out the "proper" way to shape it. $limit sets a limit on how many words it will make. Inf means there's no limit. Your assumption that it must be

Re: Could this be any more obscure?

2018-09-26 Thread Brad Gilbert
`$limit` isn't an array index. It's an argument that is passed on to the Iterator that tells it to stop when it has produced that many values. (Also it returns a `Seq`, not a `Positional` [fixed]) You can think of it as the following: 'abc def'.words.head( $limit ); `words` does something

Re: words[] question

2018-09-26 Thread Larry Wall
On Wed, Sep 26, 2018 at 01:16:26PM -0400, Parrot Raiser wrote: : Would it be correct to say: : [ ] aka square brackets, always surround the subscript of an array or : list, i.e. here "n: is an integer, [n] always means the nth item, : while : ( ), round brackets or parentheses, separate and

Re: Installing Perl6 on shared server

2018-09-26 Thread Parrot Raiser
P.S. By today's standards, that's a pretty chintzy service; are their limits aimed at IoT thingies?

Re: words[] question

2018-09-26 Thread Parrot Raiser
Would it be correct to say: [ ] aka square brackets, always surround the subscript of an array or list, i.e. here "n: is an integer, [n] always means the nth item, while ( ), round brackets or parentheses, separate and group items to control processing order, and identify subroutine calls,

Re: Installing Perl6 on shared server

2018-09-26 Thread Parrot Raiser
> I'm not sure which of these is limiting the compilation of rakudo. 2 out of 3 ain’t bad? :-( Unfortunately, they're && not ||. :-)* On 9/26/18, Elizabeth Mattijsen wrote: >> On 26 Sep 2018, at 06:03, Richard Hainsworth >> wrote: >> >> Further to this question. Support staff at hosting

Re: Could this be any more obscure?

2018-09-26 Thread The Sidhekin
On Wed, Sep 26, 2018 at 8:58 AM Todd Chester wrote: > Hi All, > > Over on > https://docs.perl6.org/routine/words > I see > > multi method words(Str:D $input: $limit = Inf --> Positional) > > HOW IN THE WORLD did they convert `$limit = Inf` into an > array index!?!?! > It's not. It's

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 7:21 AM, Brandon Allbery wrote: You're imposing a shape on this, then getting angry at us when it turns out to be wrong. I'm sorry nobody could read your mind ahead of time to find out the "proper" way to shape it. Hi Brandon, Uh Oh ! Better fix this. I am not angry. I am

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
No, that's not it either. words is "split at whitespace until you've made $limit chunks". It doesn't know or care what you do afterward with the Seq. And the [] are afterward, they apply to the Seq, not to words() which doesn't even know about them. On Wed, Sep 26, 2018 at 5:19 PM ToddAndMargo

Re: words[] question

2018-09-26 Thread Brandon Allbery
You're still assuming they're the "same thing"in some sense. The type of the () postfix operator says it applies to a function or method (more specifically, to something that supports the Callable role), thus to "words" itself. The type of the [] postfix operator says it applies to something that

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
I told you that. Others told you that. You ignored it and asked the same question again, because what we said that exlains what words() is doing doesn't fit how you've decided words() must work. No amount of documentation can fix "I think the accelerator is the brake pedal, and if it's not then

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On Wed, Sep 26, 2018 at 2:57 AM Todd Chester multi method words(Str:D $input: $limit = Inf --> Positional) On 9/26/18 7:21 AM, Brandon Allbery wrote: $limit sets a limit on how many words it will make. Inf means there's no limit. Your assumption that it must be some kind of array index

Re: Could this be any more obscure?

2018-09-26 Thread Laurent Rosenfeld via perl6-users
You can set a limit to the number of items (words) you want to retrieve: you will get only the first $limit words. If you don't supply any limit, Inf can be thought as the default value for the number of items, i.e. there is no limit and the routine will return as many words as it can from the

Re: words[] question

2018-09-26 Thread ToddAndMargo
On 9/26/18 11:42 AM, Larry Wall wrote: On Wed, Sep 26, 2018 at 01:16:26PM -0400, Parrot Raiser wrote: : Would it be correct to say: : [ ] aka square brackets, always surround the subscript of an array or : list, i.e. here "n: is an integer, [n] always means the nth item, : while : ( ), round

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 10:47 AM, The Sidhekin wrote: On Wed, Sep 26, 2018 at 8:58 AM Todd Chester > wrote: Hi All, Over on https://docs.perl6.org/routine/words I see     multi method words(Str:D $input: $limit = Inf --> Positional) HOW IN THE WORLD

Re: words[] question

2018-09-26 Thread ToddAndMargo
On 9/26/18 2:40 PM, Brandon Allbery wrote: Do you really think every function that produces a "list" has built into it secret knowledge of how you would index a list? They just produce a "Positional" or "Seq" or "List", etc. and *those* know what to do with []. The function doesn't even need

Re: words[] question

2018-09-26 Thread Brandon Allbery
We really are not communicating at all, are we? It says "--> Positional". Positional is a role specifying what to do with []. Positional is what knows what to do with [], so words() and lines() and everything else that produces a Positional doesn't have to know that. This is more or less the

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
I question "actually do RTFM", because you apparently think words() has to not only explain in complete detail what "Positional" means, but also must be rewritten to perform the Positional role itself via a $selection parameter instead of letting the Positional role do the job for which it exists.

Re: Could this be any more obscure?

2018-09-26 Thread The Sidhekin
On Wed, Sep 26, 2018 at 11:40 PM ToddAndMargo wrote: > What I don't understand is: > > multi method words(Str:D $input: $limit = Inf --> Positional) > > Specifically "$limit = Inf". Why are we using "$limit" instead > of "$selection" > Perhaps this would be easier if you explain where

Re: words[] question

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:04 AM, Brian Duggan wrote: On Tuesday, September 25, Todd Chester wrote: Not to ask too obvious a question, but why does words use a [] instead of a () ? ... I am confused as to when to use [] and when to use () with a method. If a method is called without arguments, the () can

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 2:45 PM, Brandon Allbery wrote: And I'm trying to figure out how to explain $limit since the one everyone else has used apparently means nothing whatsoever. Unless you've just been ignoring those as irrelevant, because it's not whatever you mean by "$selection" that nobody else can

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 3:12 PM, Brandon Allbery wrote: I told you that. Others told you that. You ignored it and asked the same question again, because what we said that exlains what words() is doing doesn't fit how you've decided words() must work. No amount of documentation can fix "I think the

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
What do you believe your $selection should mean? And I'm trying to figure out how to explain $limit since the one everyone else has used apparently means nothing whatsoever. Unless you've just been ignoring those as irrelevant, because it's not whatever you mean by "$selection" that nobody else

Just posted a documentation RFE

2018-09-26 Thread ToddAndMargo
Hi All, I just posted a documentation fix and RFE A booboo and an rfe in contains documentation https://github.com/perl6/doc/issues/2334 Thank you all for helping me understand to the point that I can stop grumbling and start being part of the solution. :-) -T Over on

Re: Could this be any more obscure?

2018-09-26 Thread Curt Tilmes
On Wed, Sep 26, 2018 at 6:13 PM Brandon Allbery wrote: > On Wed, Sep 26, 2018 at 6:09 PM ToddAndMargo > wrote: > >> multi method words(Str:D $input: $limit = Inf --> Positional) >> > "a b c d".words(3); (a b c) passing the $limit parameter in with 3, limits the number of words returned to 3.

Re: Could this be any more obscure?

2018-09-26 Thread Curt Tilmes
For each instance you are using [], it is the same as assigning to a variable, then calling [] on it. $ p6 '"a b c d e".words(3).say;' (a b c) same as my @x = "a b c d e".words(3); @x.say $ p6 '"a b c d e".words(3)[ 2, 4 ].say;' (c Nil) same as my @x = '"a b c d e".words(3); # same as @x =

Re: Could this be any more obscure?

2018-09-26 Thread The Sidhekin
On Thu, Sep 27, 2018 at 3:03 AM ToddAndMargo wrote: > On 9/26/18 5:55 PM, Curt Tilmes wrote: > > You are calling [] on the thing that the methods return. > > Yes, I know. And it is human readable too. It is one of the > many reasons I adore Perl 6. > > Where in > multi method words(Str:D

Re: Could this be any more obscure?

2018-09-26 Thread Peter Scott
On 9/26/2018 3:21 PM, ToddAndMargo wrote: I use words all the time.  I never would have figured it out from     multi method words(Str:D $input: $limit = Inf --> Positional) Do your really think any beginner would be able to figure out "words" from the above? If the beginner had studied the

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:18 PM, Curt Tilmes wrote:> > > The methods don't take []. You are calling [] on the thing that the > > methods return. Yes, I know. And it is human readable too. It is one of the many reasons I adore Perl 6. Where in multi method words(Str:D

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:08 PM, Brandon Allbery wrote: In the part that says "Positional". You have already been told this. Hi Brandon, Sorry for the frustration. It did not sink in until Curt explained it to me. I did look up Positional before posting this. It did not sink in either.

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:03 PM, Timo Paulssen wrote: You're still missing that the words method doesn't "take the [2,4]". The operation that [2,4] does takes place after the words() thing has already done its work. You could actually say that every method takes [0]. Try it! Your confusion looks a bit

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 3:25 PM, Brandon Allbery wrote: I question "actually do RTFM", because you apparently think words() has to not only explain in complete detail what "Positional" means, but also must be rewritten to perform the Positional role itself via a $selection parameter instead of letting the

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 7:04 PM, Brandon Allbery wrote: It doesn't. It just improves error messages. words() produces a list-like thing; that's what really matters, because list-like things do the Positional role. Declaring it up front lets Perl 6 give you an error message early if you use the result in

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
On Wed, Sep 26, 2018 at 10:04 PM ToddAndMargo wrote: > I presume you have P5's perldocs installed. Pick > out any functions (perldoc -f name) and take > a look at how extraordinarily simple their explanations > are to understand. You almost never have to ask for help. > From my two postings

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 7:08 PM, Brandon Allbery wrote: English is not a programming language, so it will not help you with understanding what Positional is. Or Callable. Or Mix, or any of the other types and roles in Perl 6. Perl 5 has none of these, so it is never a problem in Perl 5. Instead you have to

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 7:28 PM, Curt Tilmes wrote: On Wed, Sep 26, 2018 at 10:19 PM ToddAndMargo > wrote: My understanding it that if it uses "--Positinal" I can use [] Yes.  Everything described here: https://docs.perl6.org/type/Positional You can also call

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 7:01 PM, Curt Tilmes wrote: And where is it stated that an empty () defaults to all of them and not to none of them? empty() says set everything to defaults If you have sub foo($x = 3) { say $x } and call foo(2), $x will be set to 2 and it will print out 2. If you don't

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 4:33 PM, The Sidhekin wrote: On Wed, Sep 26, 2018 at 11:40 PM ToddAndMargo > wrote: What I don't understand is:       multi method words(Str:D $input: $limit = Inf --> Positional) Specifically "$limit = Inf".  Why are we using "$limit"

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
On Wed, Sep 26, 2018 at 8:49 PM ToddAndMargo wrote: > > $ p6 '"a b c d e".words[ 2, 4 ].say;' > (c e) > > or > > $ p6 '"a b c d e".words()[ 2, 4 ].say;' > (c e) > > I am selecting the 2nd and 4th word starting from zero. Inside > the brackets I am asking it to select th e 2nd and 4th words for

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
On Wed, Sep 26, 2018 at 9:03 PM ToddAndMargo wrote: > Where in > multi method words(Str:D $input: $limit = Inf --> Positional) > does it state that "words" will do that? Not all methods will. > So it need to be stated when they will.\ > In the part that says "Positional". You have already

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
Additionally: Perl 5 docs don't run into this because perl 5 has only 3 types: scalar, list, hash. Perl 6 has lots of types, each of which has its own behavior. We use roles to package up common behaviors. Positional is the role for "can be indexed" / "understands []". Don't just assume you know

Re: Could this be any more obscure?

2018-09-26 Thread The Sidhekin
On Thu, Sep 27, 2018 at 2:49 AM ToddAndMargo wrote: > On 9/26/18 4:33 PM, The Sidhekin wrote: > > On Wed, Sep 26, 2018 at 11:40 PM ToddAndMargo > > wrote: > > > And where is it stated what goes in the () and what goes > > in the []? > > > > > >The ()

Re: Could this be any more obscure?

2018-09-26 Thread The Sidhekin
On Thu, Sep 27, 2018 at 3:14 AM Peter Scott wrote: > On 9/26/2018 3:21 PM, ToddAndMargo wrote: > > Do your really think any beginner would be able to figure out > > "words" from the above? > > If the beginner had studied the metasyntax of function prototypes, > probably. Yeah, that's where a

Re: Could this be any more obscure?

2018-09-26 Thread Curt Tilmes
On Wed, Sep 26, 2018 at 9:40 PM ToddAndMargo wrote: > Would you take a swipe at "$limit = Inf" > In the signature like that it is just a default. If you pass in a $limit parameter, that gets used like "a b c d e".words(3) sets $limit to 3, limiting words() to 3 words. If you don't pass

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:47 PM, Curt Tilmes wrote: In the signature like that it is just a default.  If you pass in a $limit parameter, that gets used like "a b c d e".words(3) sets $limit to 3, limiting words() to 3 words. Oh I get it now. I was thinking it had to do with the list. And do I presume

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 2:30 PM, Laurent Rosenfeld via perl6-users wrote: You can set a limit to the number of items (words) you want to retrieve: you will get only the first $limit words. If you don't supply any limit, Inf can be thought as the default value for the number of items, i.e. there is no

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
Actually, let's try a simpler one: pyanfar Z$ 6 'say ([5])[0]' 5 The list [5] understands Positional, and therefore knows about what to do with the [0]. The parentheses are only because [5][0] looks a bit strange; but that one works the same way. The same is true of the list that words()

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
And again: this is only because you know perl 5. People are not born knowing perl 5; to someone who doesn't know it, perldoc raises the same kinds of questions you have been asking, and the answers have to be found in perlsyn or perldata, etc. Which is exactly what you have been complaining about

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:36 PM, The Sidhekin wrote: On Thu, Sep 27, 2018 at 3:14 AM Peter Scott > wrote: On 9/26/2018 3:21 PM, ToddAndMargo wrote: > Do your really think any beginner would be able to figure out > "words" from the above? If the beginner had studied

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
I often feel like perlmonks is about 80% of what's wrong with perl 5 these days. On Wed, Sep 26, 2018 at 10:27 PM ToddAndMargo wrote: > On 9/26/18 6:36 PM, The Sidhekin wrote: > > On Thu, Sep 27, 2018 at 3:14 AM Peter Scott > > wrote: > > > > On 9/26/2018 3:21 PM,

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 5:55 PM, Curt Tilmes wrote: For each instance you are using [], it is the same as assigning to a variable, then calling [] on it. $ p6 '"a b c d e".words(3).say;' (a b c) same as my @x = "a b c d e".words(3); @x.say $ p6 '"a b c d e".words(3)[ 2, 4 ].say;' (c Nil) same as my @x

Re: Could this be any more obscure?

2018-09-26 Thread Timo Paulssen
You're still missing that the words method doesn't "take the [2,4]". The operation that [2,4] does takes place after the words() thing has already done its work. You could actually say that every method takes [0]. Try it! Your confusion looks a bit similar to seeing     multi sub exp(Cool:D

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:06 PM, The Sidhekin wrote: On Thu, Sep 27, 2018 at 3:03 AM ToddAndMargo > wrote: On 9/26/18 5:55 PM, Curt Tilmes wrote: > You are calling [] on the thing that the methods return. Yes, I know.  And it is human readable too.  It is one of

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:19 PM, The Sidhekin wrote: On Thu, Sep 27, 2018 at 2:49 AM ToddAndMargo > wrote: On 9/26/18 4:33 PM, The Sidhekin wrote: > On Wed, Sep 26, 2018 at 11:40 PM ToddAndMargo mailto:toddandma...@zoho.com> >

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 5:57 PM, Brandon Allbery wrote: On Wed, Sep 26, 2018 at 8:49 PM ToddAndMargo > wrote: $ p6 '"a b c d e".words[ 2, 4 ].say;' (c e) or $ p6 '"a b c d e".words()[ 2, 4 ].say;' (c e) I am selecting the 2nd and 4th word starting

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 6:31 PM, ToddAndMargo wrote: On 9/26/18 6:18 PM, Curt Tilmes wrote:> >  > The methods don't take [].  You are calling [] on the thing that the >  > methods return.     Yes, I know.  And it is human readable too.  It is one of the     many reasons I adore Perl 6.    

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
It doesn't. It just improves error messages. words() produces a list-like thing; that's what really matters, because list-like things do the Positional role. Declaring it up front lets Perl 6 give you an error message early if you use the result in the wrong way or if the actual implementation of

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 3:31 PM, Curt Tilmes wrote: On Wed, Sep 26, 2018 at 6:13 PM Brandon Allbery > wrote: On Wed, Sep 26, 2018 at 6:09 PM ToddAndMargo mailto:toddandma...@zoho.com>> wrote: multi method words(Str:D $input: $limit = Inf --> Positional) "a b c

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
That's not helping. What didn't you understand? Are you still expecting that it is words() that must know all the details of what a list is, because a list can't know what itself is? On Wed, Sep 26, 2018 at 10:09 PM ToddAndMargo wrote: > On 9/26/18 7:04 PM, Brandon Allbery wrote: > > It

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 7:11 PM, Brandon Allbery wrote: That's not helping. What didn't you understand? It just improves error messages. My understanding it that if it uses "--Positinal" I can use []

Re: Could this be any more obscure?

2018-09-26 Thread Brandon Allbery
No, perldoc only "tells you everything" if you already know perl 5. You do, so you don't see this. On Wed, Sep 26, 2018 at 10:15 PM ToddAndMargo wrote: > On 9/26/18 7:08 PM, Brandon Allbery wrote: > > English is not a programming language, so it will not help you with > > understanding what

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 7:17 PM, Brandon Allbery wrote: No, perldoc only "tells you everything" if you already know perl 5. You do, so you don't see this. perldocs is wonderful for the beginner. It is the ONLY thing I miss in Perl 6. I like Perl 5; I adore Perl 6. I especially love the clean up of sub

Re: Could this be any more obscure?

2018-09-26 Thread ToddAndMargo
On 9/26/18 7:28 PM, Brandon Allbery wrote: I often feel like perlmonks is about 80% of what's wrong with perl 5 these days. And they are G-R-O-U-C-H-Y too!!!

Re: words[] question

2018-09-26 Thread Todd Chester
El mié., 26 sept. 2018 a las 6:12, Todd Chester (>) escribió: Hi All, https://docs.perl6.org/routine/words is no help Not to ask too obvious a question, but why does words use a [] instead of a () ? On 09/25/2018 10:38 PM, JJ Merelo

Re: Installing Perl6 on shared server

2018-09-26 Thread Patrick Spek via perl6-users
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Wed, 26 Sep 2018 11:20:49 +0800 Richard Hainsworth wrote: > a) Is there a rakudo package for debian Stretch I can install? (I'm > just asking, but I doubt it). https://github.com/nxadm/rakudo-pkg/releases I believe Stretch is Debian 9, so you

Could this be any more obscure?

2018-09-26 Thread Todd Chester
Hi All, Over on https://docs.perl6.org/routine/words I see multi method words(Str:D $input: $limit = Inf --> Positional) HOW IN THE WORLD did they convert `$limit = Inf` into an array index!?!?! https://docs.perl6.org/type/Num#Inf And `Inf` means a number larger than Perl can handle or

Re: Installing Perl6 on shared server

2018-09-26 Thread Elizabeth Mattijsen
> On 26 Sep 2018, at 06:03, Richard Hainsworth wrote: > > Further to this question. Support staff at hosting company just informed me > that for the plan I have at present, the following limits are in place: > > 60 seconds CPU execution time per process Build time on my MBP is around 75

Re: words[] question

2018-09-26 Thread Todd Chester
El mié., 26 sept. 2018 a las 8:27, Todd Chester (>) escribió: >> El mié., 26 sept. 2018 a las 6:12, Todd Chester (mailto:toddandma...@zoho.com> >> >>) escribió: >> >>

Re: words[] question

2018-09-26 Thread Todd Chester
On 09/25/2018 11:37 PM, Todd Chester wrote: How about my `Str:D $input:` question? That chat line just told me it is an optional way of writing it. I like it!