Skip to content

Commit

Permalink
Adds "defined" to Junction
Browse files Browse the repository at this point in the history
Refs Raku#2703 (because it wasn't there) and also Raku#2632 (because it
documents autothreading)
  • Loading branch information
JJ committed Apr 2, 2019
1 parent 535e7ab commit 20330bd
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions doc/Type/Junction.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ this case on a Junction) and the result will be a C<Bool>.
Defined as:
multi method new(Junction: \values, Str :$type!)
multi method new(Junction: Str:D \type, \values)
Expand All @@ -210,6 +209,25 @@ a set of values.
my $j = Junction.new(<Þor Oðinn Loki>, type => "all");
my $n = Junction.new( "one", 1..6 )
=head2 method defined
Defined as:
multi method defined(Junction:D:)
Checks for definedness instead of Boolean values.
say ( 3 | Str).defined ; # OUTPUT: «True␤»
say (one 3, Str).defined; # OUTPUT: «True␤»
say (none 3, Str).defined; # OUTPUT: «False␤»
C<Failure>s are also considered non-defined:
my $foo=Failure.new;
say (one 3, $foo).defined; # OUTPUT: «True␤»
Since 6.d, this method will autothread.
=head2 method Bool
Defined as:
Expand Down Expand Up @@ -249,8 +267,8 @@ Defined as:
multi method gist(Junction:D:)
Collapses the L<Junction|/type/Junction> and returns a L<Str|/type/Str> composed of the type of the junction and the
L<gists|/routine/gist> of its components:
Collapses the L<Junction|/type/Junction> and returns a L<Str|/type/Str> composed
of the type of the junction and the L<gists|/routine/gist> of its components:
<a 42 c>.all.say; # OUTPUT: «all(a, 42, c)␤»
Expand Down

0 comments on commit 20330bd

Please sign in to comment.