Skip to content

Commit a0efe96

Browse files
authored
Merge pull request #1165 from Altai-man/comments
Make comment style the same in Type/ directory
2 parents 525e94e + e468490 commit a0efe96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1331
-1353
lines changed

doc/Type/Any.pod6

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ Defined as:
4141
Interprets the invocant as a list and creates an
4242
C<any>-L<Junction|/type/Junction> from it.
4343
44-
say so 2 == <1 2 3>.any; # True
45-
say so 5 == <1 2 3>.any; # False
44+
say so 2 == <1 2 3>.any; # OUTPUT: «True␤»
45+
say so 5 == <1 2 3>.any; # OUTPUT: «False␤»
4646
4747
=head2 method all
4848
@@ -53,8 +53,8 @@ Defined as:
5353
Interprets the invocant as a list and creates an
5454
C<all>-L<Junction|/type/Junction> from it.
5555
56-
say so 1 < <2 3 4>.all; # True
57-
say so 3 < <2 3 4>.all; # False
56+
say so 1 < <2 3 4>.all; # OUTPUT: «True␤»
57+
say so 3 < <2 3 4>.all; # OUTPUT: «False␤»
5858
5959
=head2 method one
6060
@@ -65,8 +65,8 @@ Defined as:
6565
Interprets the invocant as a list and creates a
6666
C<one>-L<Junction|/type/Junction> from it.
6767
68-
say so 1 == (1, 2, 3).one; # True
69-
say so 1 == (1, 2, 1).one; # False
68+
say so 1 == (1, 2, 3).one; # OUTPUT: «True␤»
69+
say so 1 == (1, 2, 1).one; # OUTPUT: «False␤»
7070
7171
=head2 method none
7272
@@ -77,15 +77,15 @@ Defined as:
7777
Interprets the invocant as a list and creates a
7878
C<none>-L<Junction|/type/Junction> from it.
7979
80-
say so 1 == (1, 2, 3).none; # False
81-
say so 4 == (1, 2, 3).none; # True
80+
say so 1 == (1, 2, 3).none; # OUTPUT: «False␤»
81+
say so 4 == (1, 2, 3).none; # OUTPUT: «True␤»
8282
8383
=head2 method list
8484
8585
Interprets the invocant as a list, and returns that L<List|/type/List>.
8686
87-
say 42.list.^name; # List
88-
say 42.list.elems; # 1
87+
say 42.list.^name; # OUTPUT: «List␤»
88+
say 42.list.elems; # OUTPUT: «1␤»
8989
9090
=head2 method push
9191
@@ -95,9 +95,9 @@ implements C<Positional> already. The argument provided will then be pushed
9595
into the newly created Array.
9696
9797
my %h;
98-
dd %h<a>; # Any (and therefor undefined)
98+
dd %h<a>; # Any (and therefore undefined)
9999
%h<a>.push(1); # .push on Any
100-
dd %h; # «Hash %h = {:a($[1])}␤» # please note the Array
100+
dd %h; # «Hash %h = {:a($[1])}␤» # please note the Array
101101
102102
=head2 routine reverse
103103
@@ -113,19 +113,19 @@ to reverse the characters in a string, use L<flip>.
113113
114114
Examples:
115115
116-
say <hello world!>.reverse; # (world! hello)
117-
say reverse ^10; # (9 8 7 6 5 4 3 2 1 0)
116+
say <hello world!>.reverse; # OUTPUT: «(world! hello)␤»
117+
say reverse ^10; # OUTPUT: «(9 8 7 6 5 4 3 2 1 0)␤»
118118
119119
=head2 method sort
120120
121121
Sorts iterables with C<infix:<cmp>> or given code object and returns a new C<List>.
122122
123123
Examples:
124124
125-
say <b c a>.sort; # (a b c)
126-
say 'bca'.comb.sort.join; # abc
127-
say 'bca'.comb.sort({$^b cmp $^a}).join; # cba
128-
say '231'.comb.sort(&infix:«<=>»).join; # 123
125+
say <b c a>.sort; # OUTPUT: «(a b c)␤»
126+
say 'bca'.comb.sort.join; # OUTPUT: «abc␤»
127+
say 'bca'.comb.sort({$^b cmp $^a}).join; # OUTPUT: «cba␤»
128+
say '231'.comb.sort(&infix:«<=>»).join; # OUTPUT: «123␤»
129129
130130
=head2 method map
131131
@@ -178,8 +178,8 @@ L<halting problem|https://en.wikipedia.org/wiki/Halting_problem> for you.
178178
If you flat an infinite list C<.flat> may return that infinite list, eating
179179
all your RAM in the process.
180180
181-
say ((1, 2), (3)).elems; # 2
182-
say ((1, 2), (3)).flat.elems; # 3
181+
say ((1, 2), (3)).elems; # OUTPUT: «2␤»
182+
say ((1, 2), (3)).flat.elems; # OUTPUT: «3␤»
183183
184184
Please not that C<flat> does not recurse into sub lists. You have to recurse by
185185
hand or reconsider your data structures. A single level of nesting can often be
@@ -188,30 +188,29 @@ signatures. For deeper structures you may consider
188188
L<gather/take|/syntax/gather take> to create a lazy list.
189189
190190
my @a = [[1,2,3],[[4,5],6,7]];
191-
say gather deepmap *.take, @a;
192-
# (1 2 3 4 5 6 7)
191+
say gather deepmap *.take, @a; # OUTPUT: «(1 2 3 4 5 6 7)␤»
193192
194193
=head2 method eager
195194
196195
Interprets the invocant as a list, evaluates it eagerly, and returns that
197196
list.
198197
199-
say (1..10).eager; # (1 2 3 4 5 6 7 8 9 10)
198+
say (1..10).eager; # OUTPUT: «(1 2 3 4 5 6 7 8 9 10)␤»
200199
201200
=head2 method elems
202201
203202
Interprets the invocant as a list, and returns the number of elements in the
204203
list.
205204
206-
say 42.elems; # 1
207-
say <a b c>.elems; # 3
205+
say 42.elems; # OUTPUT: «1␤»
206+
say <a b c>.elems; # OUTPUT: «3␤»
208207
209208
=head2 method end
210209
211210
Interprets the invocant as a list, and returns the last index of that list.
212211
213-
say 6.end; # 0
214-
say <a b c>.end; # 2
212+
say 6.end; # OUTPUT: «0␤»
213+
say <a b c>.end; # OUTPUT: «2␤»
215214
216215
=head2 method pairup
217216
@@ -224,7 +223,7 @@ constructs a pair from them, unless the item in the key position already is a
224223
pair (in which case the pair is passed is passed through, and the next
225224
list item, if any, is considered to be a key again).
226225
227-
say (a => 1, 'b', 'c').pairup.perl; # (:a(1), :b("c")).Seq
226+
say (a => 1, 'b', 'c').pairup.perl; # OUTPUT: «(:a(1), :b("c")).Seq␤»
228227
229228
=head2 sub exit
230229
@@ -247,14 +246,14 @@ Defined as:
247246
248247
Forces given object to be evaluated in item context and returns the value of it.
249248
250-
say item([1,2,3]).perl; # $[1, 2, 3]
251-
say item({ apple => 10 }).perl; # ${:apple(10)}
252-
say item("abc").perl; # "abc"
249+
say item([1,2,3]).perl; # OUTPUT: «$[1, 2, 3]␤»
250+
say item({ apple => 10 }).perl; # OUTPUT: «${:apple(10)}␤»
251+
say item("abc").perl; # OUTPUT: «"abc"␤»
253252
254253
You can also use C<$> as item contextualizer.
255254
256-
say $[1,2,3].perl; # $[1, 2, 3]
257-
say $("abc").perl; # "abc"
255+
say $[1,2,3].perl; # OUTPUT: «$[1, 2, 3]␤»
256+
say $("abc").perl; # OUTPUT: «"abc"␤»
258257
259258
=end pod
260259

doc/Type/Array.pod6

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ Example:
4646
4747
my @foo = <a b c>;
4848
@foo.push: 'd';
49-
say @foo; # [a b c d]
49+
say @foo; # OUTPUT: «[a b c d]␤»
5050
5151
Note that C<push> does not attempt to flatten its argument list. If you pass
5252
an array or list as the thing to push, it becomes one additional element:
5353
5454
my @a = <a b c>;
5555
my @b = <d e f>;
5656
@a.push: @b;
57-
say @a.elems; # 4
58-
say @a[3].join; # def
57+
say @a.elems; # OUTPUT: «4␤»
58+
say @a[3].join; # OUTPUT: «def␤»
5959
6060
Only if you supply multiple values as separate arguments to C<push> are
6161
multiple values added to the array:
@@ -64,7 +64,7 @@ multiple values added to the array:
6464
my @b = <a b>;
6565
my @c = <E F>;
6666
@a.push: @b, @c;
67-
say @a.elems; # 3
67+
say @a.elems; # OUTPUT: «3␤»
6868
6969
See L<method append|#method append> for when you want to append multiple
7070
values that are stored in a single array.
@@ -91,8 +91,8 @@ Example:
9191
my @a = <a b c>;
9292
my @b = <d e f>;
9393
@a.append: @b;
94-
say @a.elems; # 6
95-
say @a; # [a b c d e f]
94+
say @a.elems; # OUTPUT: «6␤»
95+
say @a; # OUTPUT: «[a b c d e f]␤»
9696
9797
=head2 routine shift
9898
@@ -106,8 +106,8 @@ Removes and returns the first item from the array. Fails for an empty arrays.
106106
Example:
107107
108108
my @foo = <a b>;
109-
say @foo.shift; # a
110-
say @foo.shift; # b
109+
say @foo.shift; # OUTPUT: «a␤»
110+
say @foo.shift; # OUTPUT: «b␤»
111111
say @foo.shift;
112112
CATCH { default { put .^name, ': ', .Str } };
113113
# OUTPUT: «X::Cannot::Empty: Cannot shift from an empty Array␤»
@@ -126,7 +126,7 @@ Example:
126126
127127
my @foo = <a b c>;
128128
@foo.unshift: 1, 3 ... 11;
129-
say @foo; # [(1 3 5 7 9 11) a b c]
129+
say @foo; # OUTPUT: «[(1 3 5 7 9 11) a b c]␤»
130130
131131
The notes in L<the documentation for method push|#method push> apply,
132132
regarding how many elements are added to the array.
@@ -151,7 +151,7 @@ Example:
151151
152152
my @foo = <a b c>;
153153
@foo.prepend: 1, 3 ... 11;
154-
say @foo; # [1 3 5 7 9 11 a b c]
154+
say @foo; # OUTPUT: «[1 3 5 7 9 11 a b c]␤»
155155
156156
=head2 routine splice
157157
@@ -181,8 +181,8 @@ C<$start>—and its return value is used the value of C<$elems>.
181181
Example:
182182
183183
my @foo = <a b c d e f g>;
184-
say @foo.splice(2, 3, <M N O P>); # [c d e]
185-
say @foo; # [a b M N O P f g]
184+
say @foo.splice(2, 3, <M N O P>); # OUTPUT: «[c d e]␤»
185+
say @foo; # OUTPUT: «[a b M N O P f g]␤»
186186
187187
=head2 method shape
188188
@@ -195,9 +195,9 @@ Returns the shape of the array as a list.
195195
Example:
196196
197197
my @foo[2;3] = ( < 1 2 3 >, < 4 5 6 > ); # Array with fixed dimensions
198-
say @foo.shape; # (2 3)
198+
say @foo.shape; # OUTPUT: «(2 3)␤»
199199
my @bar = ( < 1 2 3 >, < 4 5 6 > ); # Normal array (of arrays)
200-
say @bar.shape; # (*)
200+
say @bar.shape; # OUTPUT: «(*)␤»
201201
202202
=head2 method default
203203
@@ -213,14 +213,14 @@ value by using the L<is default|/routine/is default> trait the method returns
213213
the type object C<(Any)>.
214214
215215
my @a1 = 1, "two", 2.718;
216-
say @a1.default; # (Any)
217-
say @a1[4]; # (Any)
216+
say @a1.default; # OUTPUT: «(Any)␤»
217+
say @a1[4]; # OUTPUT: «(Any)␤»
218218
219219
my @a2 is default(17) = 1, "two", 3;
220-
say @a2.default; # 17
221-
say @a2[4]; # 17
220+
say @a2.default; # OUTPUT: «17␤»
221+
say @a2[4]; # OUTPUT: «17␤»
222222
@a2[1] = Nil; # (resets element to its default)
223-
say @a2[1]; # 17
223+
say @a2[1]; # OUTPUT: «17␤»
224224
225225
=head2 method of
226226
@@ -233,10 +233,10 @@ i.e. if no type constraint is given during declaration, the method
233233
returns C<(Mu)>.
234234
235235
my @a1 = 1, 'two', 3.14159; # (no type constraint specified)
236-
say @a1.of; # (Mu)
236+
say @a1.of; # OUTPUT: «(Mu)␤»
237237
238238
my Int @a2 = 1, 2, 3; # (values must be of type Int)
239-
say @a2.of; # (Int)
239+
say @a2.of; # OUTPUT: «(Int)␤»
240240
@a2.push: 'd';
241241
CATCH { default { put .^name, ': ', .Str } };
242242
# OUTPUT: «X::TypeCheck::Assignment: Type check failed in assignment to @a2; expected Int but got Str ("d")␤»

doc/Type/Attribute.pod6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ The usual way to obtain an object of type C<Attribute> is by introspection:
1919
has @!things;
2020
}
2121
my $a = Useless.^attributes(:local)[0];
22-
say $a.name; # @!things
23-
say $a.package; # (Useless)
24-
say $a.has_accessor; # False
22+
say $a.name; # OUTPUT: «@!things␤»
23+
say $a.package; # OUTPUT: «(Useless)␤»
24+
say $a.has_accessor; # OUTPUT: «False␤»
2525
2626
# modifying an attribute from the outside
2727
# this is usually not possible, but since Attribute
2828
# is at the level of the meta class, all is fair game
2929
my $instance = Useless.new;
3030
$a.set_value($instance, [1, 2, 3]);
31-
say $a.get_value($instance); # [1 2 3]
31+
say $a.get_value($instance); # OUTPUT: «[1 2 3]␤»
3232
3333
=head1 Traits
3434

doc/Type/Backtrace/Frame.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ Returns C<True> if the frame is part of a setting.
9494
9595
my $bt = Backtrace.new;
9696
my $btf = $bt[0];
97-
say $btf.is-setting; # True
97+
say $btf.is-setting; # OUTPUT: «True␤»
9898
9999
=end pod

0 commit comments

Comments
 (0)