Skip to content

Commit

Permalink
Fix type formatting for several files.
Browse files Browse the repository at this point in the history
(and some very minor textual cleanups)
  • Loading branch information
coke committed May 19, 2024
1 parent 48ae15a commit fc2dc4a
Show file tree
Hide file tree
Showing 42 changed files with 395 additions and 395 deletions.
8 changes: 4 additions & 4 deletions doc/Language/classtut.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ The third attribute represents the state of completion of a task:
=for code
has Bool $.done;

This scalar attribute (with the C<$> sigil) has a type of C<Bool>. Instead
This scalar attribute (with the C<$> sigil) has a type of L<C<Bool>|/type/Bool>. Instead
of the C<!> twigil, the C<.> twigil is used. While Raku does enforce
encapsulation on attributes, it also saves you from writing accessor
methods. Replacing the C<!> with a C<.> both declares a private attribute
Expand Down Expand Up @@ -465,7 +465,7 @@ works in more detail.
Raku is rather more liberal than many languages in the area of
constructors. A constructor is anything that returns an instance of the
class. Furthermore, constructors are ordinary methods. You inherit a
default constructor named C<new> from the base class C<Mu>, but you are
default constructor named C<new> from the base class L<C<Mu>|/type/Mu>, but you are
free to override C<new>, as the Task example does:

=begin code
Expand All @@ -481,7 +481,7 @@ The biggest difference between constructors in Raku and constructors in
languages such as C# and Java is that rather than setting up state on a
somehow already magically created object, Raku constructors create the
object themselves. They do this by calling the
L<bless|/routine/bless> method, also inherited from L<Mu|/type/Mu>.
L<bless|/routine/bless> method, also inherited from L<C<Mu>|/type/Mu>.
The C<bless> method expects a set of named parameters to provide the initial
values for each attribute.

Expand Down Expand Up @@ -600,7 +600,7 @@ eating dinner. NOM!
Declaring a class creates a new I<type object> which, by default, is installed
into the current package (just like a variable declared with C<our> scope).
This type object is an "empty instance" of the class. For example, types such as
C<Int> and C<Str> refer to the type object of one of the Raku built-in
L<C<Int>|/type/Int> and L<C<Str>|/type/Str> refer to the type object of one of the Raku built-in
classes. One can call methods on these type objects. So there is nothing special
with calling the C<new> method on a type object.

Expand Down
132 changes: 66 additions & 66 deletions doc/Language/concurrency.rakudoc

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions doc/Type/Mix.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

A C<Mix> is an immutable collection of distinct elements
in no particular order that each have a real-number weight assigned to
them. (For I<mutable> mixes, see L<MixHash|/type/MixHash> instead.)
them. (For I<mutable> mixes, see L<C<MixHash>|/type/MixHash> instead.)

C<Mix>es are often used for performing weighted random selections - see
L<.roll|/routine/roll>.
Expand Down Expand Up @@ -67,7 +67,7 @@ values become the associated numeric weights:

Elements with a 0 value, as C<b> above, are simply eliminated from the C<Mix>.

Alternatively, since C<Mix>es are L<Associative|/type/Associative>, we can use the C<%> sigil to
Alternatively, since C<Mix>es are L<C<Associative>|/type/Associative>, we can use the C<%> sigil to
declare them; in that case, we can employ C<is> to declare their type:

my %n is Mix = ("a", "a", "b" => 0, "c" => 3.14);
Expand Down Expand Up @@ -128,7 +128,7 @@ Creates a new C<Mix> from C<@args>.

Coerces the C<Mix> to a L«C<Bag>|/type/Bag». The weights are convert to
L«C<Int>|/type/Int», which means the number of keys in the resulting
C<Bag> can be fewer than in the original C<Mix>, if any of the weights
L<C<Bag>|/type/Bag> can be fewer than in the original C<Mix>, if any of the weights
are negative or truncate to zero.

=head2 method BagHash
Expand All @@ -137,7 +137,7 @@ are negative or truncate to zero.

Coerces the C<Mix> to a L«C<BagHash>|/type/BagHash». The weights are
convert to L«C<Int>|/type/Int», which means the number of keys in the
resulting C<BagHash> can be fewer than in the original C<Mix>, if any of
resulting L<C<BagHash>|/type/BagHash> can be fewer than in the original C<Mix>, if any of
the weights are negative or truncate to zero.

=head2 method reverse
Expand Down
8 changes: 4 additions & 4 deletions doc/Type/MixHash.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

A C<MixHash> is a mutable mix, meaning a collection of distinct elements in no
particular order that each have a real-number weight assigned to them. (For
I<immutable> mixes, see L<Mix|/type/Mix> instead.)
I<immutable> mixes, see L<C<Mix>|/type/Mix> instead.)

Objects/values of any type are allowed as mix elements. Within a C<MixHash>,
items that would compare positively with the L<===|/routine/===> operator are considered the
Expand Down Expand Up @@ -114,7 +114,7 @@ say $a ⊎ $b; # OUTPUT: «MixHash(2(3.5) 4(2) 3(2))␤»
=head1 Note on C<reverse> and ordering.

MixHash inherits C<reverse> from L<Any|/type/Any#routine_reverse>,
however, C<Mix>es do not have an inherent order and you should not trust
however, L<C<Mix>|/type/Mix>es do not have an inherent order and you should not trust
it returning a consistent output.

If you sort a MixHash, the result is a list of pairs, at which point
Expand All @@ -136,7 +136,7 @@ say $a.sort.reverse; # OUTPUT: «(18 => 1 4 => 1 3 => 1 2 => 2)␤»

Coerces the C<MixHash> to a L«C<Bag>|/type/Bag». The weights are converted
to L«C<Int>|/type/Int»,
which means the number of keys in the resulting C<Bag> can be fewer than in the
which means the number of keys in the resulting L<C<Bag>|/type/Bag> can be fewer than in the
original C<MixHash>, if any of the weights are negative or truncate to zero.

=head2 method BagHash
Expand All @@ -145,7 +145,7 @@ original C<MixHash>, if any of the weights are negative or truncate to zero.

Coerces the C<MixHash> to a L«C<BagHash>|/type/BagHash». The weights are converted
to L«C<Int>|/type/Int»,
which means the number of keys in the resulting C<BagHash> can be fewer than in the
which means the number of keys in the resulting L<C<BagHash>|/type/BagHash> can be fewer than in the
original C<MixHash>, if any of the weights are negative or truncate to zero.

=head1 See Also
Expand Down
8 changes: 4 additions & 4 deletions doc/Type/Mixy.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

role Mixy does Baggy { }

A role for collections of weighted values. See L<Mix|/type/Mix> and L<MixHash|/type/MixHash>.
C<Mixy> objects differ from L<Baggy|/type/Baggy> objects in that the weights of
C<Mixy> are L<Real|/type/Real>s rather than L<Int|/type/Int>s.
A role for collections of weighted values. See L<C<Mix>|/type/Mix> and L<C<MixHash>|/type/MixHash>.
C<Mixy> objects differ from L<C<Baggy>|/type/Baggy> objects in that the weights of
C<Mixy> are L<C<Real>|/type/Real>s rather than L<C<Int>|/type/Int>s.

=head1 Methods

=head2 method roll

method roll($count = 1)

Similar to a L<Bag|/type/Bag>.roll, but with C<Real> weights rather than integral
Similar to a L<C<Bag>|/type/Bag>.roll, but with L<C<Real>|/type/Real> weights rather than integral
ones.

=head2 method pick
Expand Down
16 changes: 8 additions & 8 deletions doc/Type/Mu.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ One can also say that there are many undefined values in Raku, and C<Mu> is the
I<most undefined> value.

Note that most classes do not derive from C<Mu> directly, but rather from
L<Any|/type/Any>.
L<C<Any>|/type/Any>.

=head1 Methods

Expand All @@ -37,7 +37,7 @@ Returns C<False> on a type object, and C<True> otherwise.
say Int.defined; # OUTPUT: «False␤»
say 42.defined; # OUTPUT: «True␤»

A few types (like L<Failure|/type/Failure>) override C<defined> to return
A few types (like L<C<Failure>|/type/Failure>) override C<defined> to return
C<False> even for instances:

sub fails() { fail 'oh noe' };
Expand Down Expand Up @@ -121,7 +121,7 @@ empty L<string|/type/Str> or numerical zeros

method Capture(Mu:D: --> Capture:D)

Returns a L<Capture|/type/Capture> with named arguments corresponding to
Returns a L<C<Capture>|/type/Capture> with named arguments corresponding to
invocant's public attributes:

class Foo {
Expand All @@ -135,7 +135,7 @@ invocant's public attributes:
multi method Str(--> Str)

Returns a string representation of the invocant, intended to be machine
readable. Method C<Str> warns on type objects, and produces the empty string.
readable. Method L<C<Str>|/type/Str> warns on type objects, and produces the empty string.

say Mu.Str; # Use of uninitialized value of type Mu in string context.
my @foo = [2,3,1];
Expand Down Expand Up @@ -357,7 +357,7 @@ adding a newline at end.
multi method put(--> Bool:D)

Prints value to C<$*OUT>, adding a newline at end, and if necessary,
stringifying non-C<Str> object using the C<.Str> method.
stringifying non-L<C<Str>|/type/Str> object using the C<.Str> method.

"abc".put; # OUTPUT: «abc␤»

Expand Down Expand Up @@ -407,7 +407,7 @@ mechanism when no direct candidate is available to dispatch to.

multi method WHICH(--> ObjAt:D)

Returns an object of type L<ObjAt|/type/ObjAt> which uniquely identifies the
Returns an object of type L<C<ObjAt>|/type/ObjAt> which uniquely identifies the
object. Value types override this method which makes sure that two equivalent
objects return the same return value from C<WHICH>.

Expand All @@ -417,7 +417,7 @@ objects return the same return value from C<WHICH>.

method WHERE(--> Int)

Returns an C<Int> representing the memory address of the object. Please note
Returns an L<C<Int>|/type/Int> representing the memory address of the object. Please note
that in the Rakudo implementation of Raku, and possibly other implementations,
the memory location of an object is B<NOT> fixed for the lifetime of the
object. So it has limited use for applications, and is intended as a debugging
Expand Down Expand Up @@ -464,7 +464,7 @@ The method C<return> will stop execution of a subroutine or method, run all
relevant L<phasers|/language/phasers#Block_phasers> and provide invocant as a
return value to the caller. If a return
L<type constraint|/language/signatures#Constraining_return_types> is provided it will be
checked unless the return value is C<Nil>. A control exception is raised and
checked unless the return value is L<C<Nil>|/type/Nil>. A control exception is raised and
can be caught with L<CONTROL|/language/phasers#CONTROL>.

sub f { (1|2|3).return };
Expand Down
20 changes: 10 additions & 10 deletions doc/Type/Nil.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
The value C<Nil> may be used to fill a spot where a value would normally
go, and in so doing, explicitly indicate that no value is present. It
may also be used as a cheaper and less explosive alternative to a
L<C<Failure>|/type/Failure>. (In fact, class C<Failure> is derived from C<Nil>,
so smartmatching C<Nil> will also match C<Failure>.)
L<C<Failure>|/type/Failure>. (In fact, class L<C<Failure>|/type/Failure> is derived from C<Nil>,
so smartmatching C<Nil> will also match L<C<Failure>|/type/Failure>.)

The class C<Nil> is the same exact thing as its only possible value, C<Nil>.

say Nil === Nil.new; # OUTPUT: «True␤»

Along with C<Failure>, C<Nil> and its subclasses may always be returned from a
Along with L<C<Failure>|/type/Failure>, C<Nil> and its subclasses may always be returned from a
routine even when the routine specifies a particular return type. It may also
be returned regardless of the definedness of the return type, however, C<Nil>
is considered undefined for all other purposes.
Expand Down Expand Up @@ -53,7 +53,7 @@ C<Nil>.
X<|Language,Nil assignment>
When assigned to a L<container|/language/containers>, the C<Nil> value (but not any subclass of
C<Nil>) will attempt to revert the container to its default value; if no
such default is declared, Raku assumes C<Any>.
such default is declared, Raku assumes L<C<Any>|/type/Any>.

Since a hash assignment expects two elements, use C<Empty> not C<Nil>, e.g.

Expand All @@ -63,9 +63,9 @@ Since a hash assignment expects two elements, use C<Empty> not C<Nil>, e.g.

However, if the container
type is constrained with C<:D>, assigning C<Nil> to it will immediately throw
an exception. (In contrast, an instantiated C<Failure> matches C<:D>
an exception. (In contrast, an instantiated L<C<Failure>|/type/Failure> matches C<:D>
because it's a definite value, but will fail to match the actual nominal
type unless it happens to be a parent class of C<Failure>.) Native types can
type unless it happens to be a parent class of L<C<Failure>|/type/Failure>.) Native types can
not have default values nor hold a type object. Assigning C<Nil> to a native
type container will fail with a runtime error.

Expand Down Expand Up @@ -95,7 +95,7 @@ my Int:D $j = g;
# Type check failed in assignment to $j; expected Int:D but got Failure (Failure.new(exception...)
# in block <unit> at <unknown file> line 1

Because an untyped variable is type C<Any>, assigning a C<Nil> to one
Because an untyped variable is type L<C<Any>|/type/Any>, assigning a C<Nil> to one
will result in an L<(Any)|/type/Any> type object.

my $x = Nil;
Expand All @@ -121,7 +121,7 @@ assigning C<Nil> to a variable which has a default will restore that default.
$x.say; # OUTPUT: «42␤»

Methods such as C<BIND-POS>, C<ASSIGN-KEY>, C<ASSIGN-POS> will die;
C<BIND-KEY> will produce a failure with an C<X::Bind> exception in it, and
C<BIND-KEY> will produce a failure with an L<C<X::Bind>|/type/X::Bind> exception in it, and
C<STORE> will produce an L<C<X::Assignment::RO>|/type/X::Assignment::RO> exception.

=head1 Methods
Expand Down Expand Up @@ -170,7 +170,7 @@ Warns the user that they tried to unshift onto a C<Nil> or derived type object.

=head2 method ords

Returns an empty C<Seq>, but will also issue a warning depending on the
Returns an empty L<C<Seq>|/type/Seq>, but will also issue a warning depending on the
context it's used (for instance, a warning about using it in string context
if used with C<say>).

Expand All @@ -183,7 +183,7 @@ Will return C<\0>, and also throw a warning.
method FALLBACK(| --> Nil) {}

The L<fallback method|/language/typesystem#index-entry-FALLBACK_(method)>
takes any arguments and always returns a L<Nil|/type/Nil>.
takes any arguments and always returns a C<Nil>.

=head2 method Numeric

Expand Down
14 changes: 7 additions & 7 deletions doc/Type/Num.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ L<IEEE 754-2008 standard|https://ieeexplore.ieee.org/document/4610935>.

The C<∞> C<U+221E> Unicode character can be used instead of
the word C<Inf> and can be handy when C<Inf> would otherwise require an
L<unspace|/language/syntax#Unspace>, such as when writing L<Complex|/type/Complex> numbers:
L<unspace|/language/syntax#Unspace>, such as when writing L<C<Complex>|/type/Complex> numbers:

say Inf+Inf\i; # Backslash (unspace) before `i` required
say ∞+∞i; # No backslash is needed
Expand Down Expand Up @@ -60,7 +60,7 @@ Division of an infinity by another infinity results in a C<NaN>:

The value X<C<NaN>|Reference,NaN (definition)> is an instance of C<Num> and represents a
floating point not-a-number value, which is returned from some routines where
a concrete number as the answer is not defined, but a L<Numeric|/type/Numeric> value is still
a concrete number as the answer is not defined, but a L<C<Numeric>|/type/Numeric> value is still
acceptable. C<NaN> is L<defined|/routine/defined> and L<boolifies|/routine/Bool>
to C<True>, but is I<not> numerically equal to any value (including itself).

Expand Down Expand Up @@ -107,24 +107,24 @@ Throws C<X::Cannot::Capture>.

method Int(Num:D:)

Converts the number to an L<Int|/type/Int>. L<Fails|/routine/fail> with
Converts the number to an L<C<Int>|/type/Int>. L<Fails|/routine/fail> with
C<X::Numeric::CannotConvert> if the invocant L«is a C<NaN>|/routine/isNaN»
or C<Inf>/C<-Inf>. No L<rounding|/routine/round> is performed.

=head2 method Rat

method Rat(Num:D: Real $epsilon = 1e-6)

Converts the number to a L<Rat|/type/Rat> with C<$epsilon> precision. If the invocant
is a C<Inf>, C<-Inf>, or a C<NaN>, converts them to a L<Rat|/type/Rat> with C<0>
Converts the number to a L<C<Rat>|/type/Rat> with C<$epsilon> precision. If the invocant
is a C<Inf>, C<-Inf>, or a C<NaN>, converts them to a L<C<Rat>|/type/Rat> with C<0>
L<denominator|/routine/denominator> and C<1>, C<-1>, or C<0> L<numerator|/routine/numerator>, respectively.

=head2 method FatRat

method FatRat(Num:D: Real $epsilon = 1e-6)

Converts the number to a L<FatRat|/type/FatRat> with the precision C<$epsilon>. If invocant
is a C<Inf>, C<-Inf>, or a C<NaN>, converts them to a L<FatRat|/type/FatRat> with C<0>
Converts the number to a L<C<FatRat>|/type/FatRat> with the precision C<$epsilon>. If invocant
is a C<Inf>, C<-Inf>, or a C<NaN>, converts them to a L<C<FatRat>|/type/FatRat> with C<0>
L<denominator|/routine/denominator> and C<1>, C<-1>, or C<0> L<numerator|/routine/numerator>, respectively.

=head2 method Num
Expand Down
8 changes: 4 additions & 4 deletions doc/Type/NumStr.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ say 42e10 ∈ <42e10 55 1>; # OUTPUT: «False␤»

method new(Num $i, Str $s)

The constructor requires both the C<Num> and the C<Str> value, when constructing one
The constructor requires both the L<C<Num>|/type/Num> and the C<C<Str>|/type/Str> value, when constructing one
directly the values can be whatever is required:

my $f = NumStr.new(42.1e0, "forty two and a bit");
Expand All @@ -40,7 +40,7 @@ directly the values can be whatever is required:

method Num

Returns the C<Num> value of the C<NumStr>.
Returns the C<C<Num>|/type/Num> value of the C<NumStr>.

=head2 method Numeric

Expand All @@ -64,8 +64,8 @@ a warning about using an uninitialized value in numeric context and then returns

multi sub infix:<===>(NumStr:D $a, NumStr:D $b)

C<NumStr> Value identity operator. Returns C<True> if the C<Num>
values of C<$a> and C<$b> are L<identical|/routine/===> and their C<Str>
C<NumStr> Value identity operator. Returns C<True> if the L<C<Num>|/type/Num>
values of C<$a> and C<$b> are L<identical|/routine/===> and their L<C<Str>|/type/Str>
values are also L<identical|/routine/===>. Returns C<False> otherwise.

=end pod

0 comments on commit fc2dc4a

Please sign in to comment.