4
4
5
5
= SUBTITLE Accessing data structure elements by index or key
6
6
7
- Often one needs to refer to a specific element (or specific slice of
7
+ One often needs to refer to a specific element (or slice of
8
8
elements) of a collection or data structure. Borrowing from mathematical
9
9
notation where the components of a vector I < v > would be referred to as
10
10
I < v₁, v₂, v₃ > , this concept is called "subscripting" (or "indexing") in
@@ -649,9 +649,7 @@ subscripting interface.
649
649
650
650
= head2 Custom type example
651
651
652
- = comment TODO: Maybe factor this out into a tutorial page
653
-
654
- Imagine a HTTP::Header type which, despite being a custom class with special
652
+ Imagine a C < HTTP::Header > type which, despite being a custom class with special
655
653
behavior, can be indexed like a hash:
656
654
657
655
= begin code
@@ -667,7 +665,7 @@ behavior, can be indexed like a hash:
667
665
my $rawheader = $request.header.Str; # stringify according to HTTP spec
668
666
= end code
669
667
670
- The simplest way to implement this class, would be to give it an attribute of
668
+ A simple way to implement this class would be to give it an attribute of
671
669
type L < Hash > , and delegate all subscripting and iterating related functionality
672
670
to that attribute (using a custom type constraint to make sure users don't
673
671
insert anything invalid into it):
0 commit comments