In Perl 6 most normal operators are subroutines:

    @a[1..3]
    &postcircumfix:« [  ] »( @a,    1..3 ) # same as above

Since they are just subroutines they often just call something else.

    # an overly simplified version
    sub postcircumfix:« [  ] » ( @array, **@indicies ) {
        gather {
            for @indicies -> $index {
                take @array.AT-POS( $index )
            }
        }
    }

When you define such a subroutine for the first time, it modifies the parser.

In the case of &postcircumfix:« [  ] », it can take ANY VALUE as its
first argument.
On `Positional` arguments it calls `.AT-POS`.
If it isn't `Positional`, it will pretend that it is a list of one value.

   1[0];   # pretend that `1` is the same as `(1,)`

This means it can be found everywhere throughout the language.

---

We do not want to describe every bit of the language that interacts
with the `.words` method.
This is because that would be the entire language on one page.

When you talked about [], this is inadvertently what you asked for.

---

In the case of the `.words()` document we say that it is called on
`Str` and returns a `Seq`.
(The docs were wrong about it returning a `Positional`)

We document that it returns the parts of the string that aren't whitespace.

We document that you can give a limit to how many values it returns.
(arguably, this isn't needed because you can just call `.head($limit)` instead)

If we changed it to `selection` it would make it seem more complicated
than it really is.
Selection could mean that it could select the second and third values.
`.words()` doesn't do that.

The closest synonyms would be:
    cap
    maximum
    upper bound
    cutoff point
    farthest point
    end
    max count

We do not document every single operator that operates on a `Seq`, on that page.
(Almost every single one of them.)
Again, [] is one of them.

We do not document on that page all of the methods of `Seq`.
(There is a page specifically for that)

On Wed, Sep 26, 2018 at 9:18 PM ToddAndMargo <toddandma...@zoho.com> wrote:
>
> 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 []

Reply via email to