You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/Type/Junction.pod6
+23-5Lines changed: 23 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ L<C<.all>|/routine/all>, L<C<.none>|/routine/none> or L<C<.one>|/routine/one> on
34
34
the object.
35
35
36
36
say so 3 == (1..30).one; # OUTPUT: «True»
37
-
say so ("a" ^ "b" ^ "c") eq "a"; # OUTPUT: «True»
37
+
say so ("a" ^ "b" ^ "c") eq "a"; # OUTPUT: «True»
38
38
39
39
Autothreading happens when a junction is bound to a parameter of a code object
40
40
that doesn't accept values of type C<Junction>. Instead of producing an error,
@@ -196,6 +196,22 @@ this case on a Junction) and the result will be a C<Bool>.
196
196
197
197
=head1Methods
198
198
199
+
=head2method new
200
+
201
+
Defined as:
202
+
203
+
204
+
multi method new(Junction: \values, Str :$type!)
205
+
multi method new(Junction: Str:D \type, \values)
206
+
207
+
Constructor to define a new Junction from the type that defines de Junction and
208
+
a set of values.
209
+
210
+
my $j = Junction.new(<Þor Oðinn Loki>, type => "all");
211
+
my $n = Junction.new( "one", 1..6 )
212
+
213
+
214
+
199
215
=head2method Str
200
216
201
217
Defined as:
@@ -237,9 +253,9 @@ Defined as:
237
253
multi sub infix:<~>(Junction:D $a, Str:D $b)
238
254
multi sub infix:<~>(Junction:D \a, Junction:D \b)
239
255
240
-
The infix C<~> concatenation can be used to merge junctions into a single one or merge Junctions with strings.
241
-
The resulting junction will have all elements merged as if they were
242
-
joined into a nested loop:
256
+
The infix C<~> concatenation can be used to merge junctions into a single one or
257
+
merge Junctions with strings. The resulting junction will have all elements
258
+
merged as if they were joined into a nested loop:
243
259
244
260
=begincode
245
261
my $odd = 1|3|5;
@@ -256,7 +272,9 @@ my $postfixed = $odd ~ "1";
256
272
say "Found 11" if 11 == $postfixed; #OUTPUT: «Found 11!»
257
273
=endcode
258
274
259
-
On the other hand, the versions of C<~> that use a string as one argument will just concatenate the string to every member of the Junction, creating another Junction with the same number of elements.
275
+
On the other hand, the versions of C<~> that use a string as one argument will
276
+
just concatenate the string to every member of the Junction, creating another
0 commit comments