Skip to content

Commit b95e6b0

Browse files
committed
Documents junction.new refs #2703
1 parent 96546a4 commit b95e6b0

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

doc/Type/Junction.pod6

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ L<C<.all>|/routine/all>, L<C<.none>|/routine/none> or L<C<.one>|/routine/one> on
3434
the object.
3535
3636
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␤»
3838
3939
Autothreading happens when a junction is bound to a parameter of a code object
4040
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>.
196196
197197
=head1 Methods
198198
199+
=head2 method 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+
199215
=head2 method Str
200216
201217
Defined as:
@@ -237,9 +253,9 @@ Defined as:
237253
multi sub infix:<~>(Junction:D $a, Str:D $b)
238254
multi sub infix:<~>(Junction:D \a, Junction:D \b)
239255
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:
243259
244260
=begin code
245261
my $odd = 1|3|5;
@@ -256,7 +272,9 @@ my $postfixed = $odd ~ "1";
256272
say "Found 11" if 11 == $postfixed; #OUTPUT: «Found 11!␤»
257273
=end code
258274
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
277+
Junction with the same number of elements.
260278
261279
=head1 See Also
262280

0 commit comments

Comments
 (0)