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 18, 2024
1 parent 83172d2 commit 48ae15a
Show file tree
Hide file tree
Showing 15 changed files with 125 additions and 127 deletions.
26 changes: 13 additions & 13 deletions doc/Type/Blob.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Returns C<False> if and only if the buffer is empty.

method Capture(Blob:D:)

Converts the object to a C<List> which is, in turn, coerced to a C<Capture>.
Converts the object to a L<C<List>|/type/List> which is, in turn, coerced to a L<C<Capture>|/type/Capture>.

=head2 method elems

Expand All @@ -90,20 +90,20 @@ Returns the number of bytes used by the elements in the buffer.

method chars(Blob:D:)

Throws C<X::Buf::AsStr> with C<chars> as payload.
Throws L<C<X::Buf::AsStr>|/type/X::Buf::AsStr> with C<chars> as payload.

=head2 method Str

multi method Str(Blob:D:)

Throws C<X::Buf::AsStr> with C<Str> as payload. In order to convert to a C<Str>
Throws L<C<X::Buf::AsStr>|/type/X::Buf::AsStr> with L<C<Str>|/type/Str> as payload. In order to convert to a L<C<Str>|/type/Str>
you need to use L<C<.decode>|/routine/decode>.

=head2 method Stringy

multi method Stringy(Blob:D:)

Throws C<X::Buf::AsStr> with C<Stringy> as payload.
Throws L<C<X::Buf::AsStr>|/type/X::Buf::AsStr> with L<C<Stringy>|/type/Stringy> as payload.

=head2 method decode

Expand All @@ -115,7 +115,7 @@ multi method decode(Blob:D: $encoding, Str :$replacement!,

multi method decode(Blob:D: $encoding, Bool:D :$strict = False)

Applies an encoding to turn the blob into a L<Str|/type/Str>; the encoding will
Applies an encoding to turn the blob into a L<C<Str>|/type/Str>; the encoding will
be UTF-8 by default.

my Blob $blob = "string".encode('utf-8');
Expand All @@ -128,17 +128,17 @@ L«C<utf8-c8>|/language/unicode#UTF8-C8».

multi method list(Blob:D:)

Returns a C<List> of integers:
Returns a L<C<List>|/type/List> of integers:

say "zipi".encode("ascii").list; # OUTPUT: «(122 105 112 105)␤»

=head2 method gist

method gist(Blob:D: --> Str:D)

Returns the string containing the "gist" of the L<Blob|/type/Blob>,
Returns the string containing the "gist" of the C<Blob>,
B<listing up to the first 100> elements, separated by space, appending an
ellipsis if the L<Blob|/type/Blob> has more than 100 elements.
ellipsis if the C<Blob> has more than 100 elements.

put Blob.new(1, 2, 3).gist; # OUTPUT: «Blob:0x<01 02 03>␤»
put Blob.new(1..2000).gist;
Expand Down Expand Up @@ -167,7 +167,7 @@ shorter), and creates a new buffer as the result.
say Blob.new(1..10).subbuf(*-2); # OUTPUT: «Blob:0x<09 0a>␤»
say Blob.new(1..10).subbuf(*-5,2); # OUTPUT: «Blob:0x<06 07>␤»

For convenience, also allows a C<Range> to be specified to indicate which
For convenience, also allows a L<C<Range>|/type/Range> to be specified to indicate which
part of the invocant buffer you would like:

say Blob.new(1..10).subbuf(2..5); # OUTPUT: «Blob:0x<03 04 05 06>␤»
Expand All @@ -185,14 +185,14 @@ part of the invocant buffer you would like:
Returns a newly created C<Blob> object with the given number of elements.
Optionally takes a second argument that indicates the pattern with which to fill
the C<Blob>: this can be a single (possibly native) integer value, or any
C<Iterable> that generates integer values, including another C<Blob>. The
L<C<Iterable>|/type/Iterable> that generates integer values, including another C<Blob>. The
pattern will be repeated if not enough values are given to fill the entire
C<Blob>.

my Blob $b0 = Blob.allocate(10,0);
$b0.say; # OUTPUT: «Blob:0x<00 00 00 00 00 00 00 00 00 00>␤»

If the pattern is a general C<Mu> value, it will fail.
If the pattern is a general L<C<Mu>|/type/Mu> value, it will fail.

=head2 routine unpack

Expand Down Expand Up @@ -284,7 +284,7 @@ endianness (native, little and big endianness). The returned values are
always expanded to a 64 bit native value where possible, and to a (big)
integer value if that is not possible.

Endianness must be indicated by using values of the L<Endian|/type/Endian>
Endianness must be indicated by using values of the L<C<Endian>|/type/Endian>
enum as the B<second> parameter to these methods. If no endianness is
specified, C<NativeEndian> will be assumed. Other values are
C<LittleEndian> and C<BigEndian>.
Expand Down Expand Up @@ -397,6 +397,6 @@ C<BigEndian>.

Available as of the 2021.06 Rakudo compiler release.

Coerces the invocant into a mutable L<Buf|/type/Buf> object.
Coerces the invocant into a mutable L<C<Buf>|/type/Buf> object.

=end pod
8 changes: 4 additions & 4 deletions doc/Type/Distribution.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
This role is an interface for objects that provide API access mapping META6 data
to the files it represents. Objects that fulfill the C<Distribution> role can be
read by e.g.
L<CompUnit::Repository::Installation|/type/CompUnit::Repository::Installation>.
L<C<CompUnit::Repository::Installation>|/type/CompUnit::Repository::Installation>.
Generally a C<Distribution> provides read access to a set of modules and
metadata. These may be backed by the filesystem
(L<Distribution::Path|/type/Distribution::Path>,
L<Distribution::Hash|/type/Distribution::Hash>) but could also read from an e.g.
(L<C<Distribution::Path>|/type/Distribution::Path>,
L<C<Distribution::Hash>|/type/Distribution::Hash>) but could also read from an e.g.
tar file or socket.

=head1 Required Methods
Expand All @@ -30,7 +30,7 @@ format.

method content($name-path --> IO::Handle:D) { ... }

Returns an C<IO::Handle> to the file represented by C<$name-path>. C<$name-path>
Returns an L<C<IO::Handle>|/type/IO::Handle> to the file represented by C<$name-path>. C<$name-path>
is a relative path as it would be found in the metadata such as C<lib/Foo.rakumod>
or C<resources/foo.txt>.

Expand Down
4 changes: 2 additions & 2 deletions doc/Type/Distribution/Hash.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
=for code :preamble<role Distribution::Locally {}>
class Distribution::Hash does Distribution::Locally { }

A L<Distribution|/type/Distribution> implementation backed by the filesystem. It
A L<C<Distribution>|/type/Distribution> implementation backed by the filesystem. It
does not require a C<META6.json> file, essentially providing a lower level
L<C<Distribution::Path>|/type/Distribution::Path>.

Expand All @@ -31,7 +31,7 @@ Returns a Hash with the representation of the metadata.
Please check
L<the C<content> method in Distribution::Locally|/type/Distribution::Locally#method_content>.

Returns an C<IO::Handle> to the file represented by C<$name-path>. C<$name-path>
Returns an L<C<IO::Handle>|/type/IO::Handle> to the file represented by C<$name-path>. C<$name-path>
is a relative path as it would be found in the metadata such as C<lib/Foo.rakumod>
or C<resources/foo.txt>.

Expand Down
4 changes: 2 additions & 2 deletions doc/Type/Distribution/Path.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
=for code :preamble<role Distribution::Locally {}>
class Distribution::Path does Distribution::Locally { }

A L<Distribution|/type/Distribution> implementation backed by the filesystem. It requires a
A L<C<Distribution>|/type/Distribution> implementation backed by the filesystem. It requires a
C<META6.json> file at its root.

=head1 Methods
Expand All @@ -31,7 +31,7 @@ Returns a Hash with the representation of the metadata.

L<Distribution::Locally#method_content|/type/Distribution#method_content>

Returns an C<IO::Handle> to the file represented by C<$name-path>. C<$name-path>
Returns an L<C<IO::Handle>|/type/IO::Handle> to the file represented by C<$name-path>. C<$name-path>
is a relative path as it would be found in the metadata such as C<lib/Foo.rakumod>
or C<resources/foo.txt>.

Expand Down
2 changes: 1 addition & 1 deletion doc/Type/Distro.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ variable.

=head2 method is-win

Instance method returning a C<Bool> indicating whether the distribution is a
Instance method returning a L<C<Bool>|/type/Bool> indicating whether the distribution is a
version of the Windows operating system.

=head2 method path-sep
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/Encoding/Registry.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
C<Encoding::Registry> is initialized with a list of encoding that is
available for any Raku application, namely:

=item L<C<utf8>|/type/utf8>
=item C<utf8>
=item C<utf8-c8>
=item C<utf16>
=item C<utf16le>
Expand Down
18 changes: 9 additions & 9 deletions doc/Type/Enumeration.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ say Foo ~~ bar; # OUTPUT: «False␤»
=head1 Methods that work on the enum class

As of release 2021.04 of the Rakudo compiler, an enum class can be
considered as an instantiated L<Map|/type/Map> object. This means
considered as an instantiated L<C<Map>|/type/Map> object. This means
you can use the
L<keys|/type/Map#method_keys>,
L<values|/type/Map#method_values>,
Expand All @@ -91,7 +91,7 @@ on an enum class and get the expected result.

method enums()

Returns a L<Map|/type/Map> of enum values. Works both on the enum type
Returns a L<C<Map>|/type/Map> of enum values. Works both on the enum type
and any key.

enum Mass ( mg => 1/1000, g => 1/1, kg => 1000/1 );
Expand Down Expand Up @@ -130,7 +130,7 @@ say g.kv; # OUTPUT: «(g 1)␤»

method pair(::?CLASS:D:)

Returns it as a C<Pair>.
Returns it as a L<C<Pair>|/type/Pair>.

=for code :preamble<<enum Mass<g> >>
say g.pair; # OUTPUT: «g => 1␤»
Expand Down Expand Up @@ -185,44 +185,44 @@ say Oðin.succ; # OUTPUT: «Freija␤»

multi method Numeric(::?CLASS:D:)

Takes a value of an enum and returns it after coercion to C<Numeric>:
Takes a value of an enum and returns it after coercion to L<C<Numeric>|/type/Numeric>:

enum Numbers ( cool => '42', almost-pi => '3.14', sqrt-n-one => 'i' );
say cool.Numeric; # OUTPUT: «42␤»
say almost-pi.Numeric; # OUTPUT: «3.14␤»
say sqrt-n-one.Numeric; # OUTPUT: «0+1i␤»

Note that if the value cannot be coerced to C<Numeric>, an exception
Note that if the value cannot be coerced to L<C<Numeric>|/type/Numeric>, an exception
will be thrown.

=head2 method Int

multi method Int(::?CLASS:D:)

Takes a value of an enum and returns it after coercion to C<Int>:
Takes a value of an enum and returns it after coercion to L<C<Int>|/type/Int>:

enum Numbers ( cool => '42', almost-pi => '3.14', sqrt-n-one => 'i' );
say cool.Int; # OUTPUT: «42␤»
say almost-pi.Int; # OUTPUT: «3␤»
try say sqrt-n-one.Int;
say $!.message if $!; # OUTPUT: «Cannot convert 0+1i to Int: imaginary part not zero␤»

Note that if the value cannot be coerced to C<Int>, an exception will
Note that if the value cannot be coerced to L<C<Int>|/type/Int>, an exception will
be thrown.

=head2 method Real

multi method Real(::?CLASS:D:)

Takes a value of an enum and returns it after coercion to C<Real>:
Takes a value of an enum and returns it after coercion to L<C<Real>|/type/Real>:

enum Numbers ( cool => '42', almost-pi => '3.14', sqrt-n-one => 'i' );
say cool.Real; # OUTPUT: «42␤»
say almost-pi.Real; # OUTPUT: «3.14␤»
try say sqrt-n-one.Real;
say $!.message if $!; # OUTPUT: «Cannot convert 0+1i to Real: imaginary part not zero␤»

Note that if the value cannot be coerced to C<Real>, an exception will
Note that if the value cannot be coerced to L<C<Real>|/type/Real>, an exception will
be thrown.

=head2 method C<===>
Expand Down
4 changes: 2 additions & 2 deletions doc/Type/ForeignCode.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ your own code, since its interface might change or even disappear in the future.
This is provided here only as a reference>

C<ForeignCode> is a Raku wrapper around code that is not written originally in
that language; its intention is to use these blocks of code in C<Callable>
that language; its intention is to use these blocks of code in L<C<Callable>|/type/Callable>
contexts easily. For instance, subs have some anonymous functions that are
actually C<ForeignCode>.

Expand All @@ -22,7 +22,7 @@ say $_.name ~ ' → ' ~ $_.^name for &does-nothing.^methods;

This script will map method names to their class, and it shows that routines, in
particular, have several methods that are actually C<ForeignCode> instead of
L<C<Method>s|/type/Method>.
L<C<Method>|/type/Method>s.


=head1 Methods
Expand Down
12 changes: 6 additions & 6 deletions doc/Type/HyperSeq.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@ Returns the underlying iterator.

method grep(HyperSeq:D: $matcher, *%options)

Applies C<grep> to the C<HyperSeq> similarly to how it would do it on a C<Seq>.
Applies C<grep> to the C<HyperSeq> similarly to how it would do it on a L<C<Seq>|/type/Seq>.

=for code
my @hyped = (^10000).map(*²).hyper;
@hyped.grep( * %% 3 ).say;
# OUTPUT: «(0 9 36 81 144 ...)␤»

When you use C<hyper> on a C<Seq>, this is the method that is actually called.
When you use C<hyper> on a L<C<Seq>|/type/Seq>, this is the method that is actually called.

=head2 method map

method map(HyperSeq:D: $matcher, *%options)

Uses maps on the C<HyperSeq>, generally created by application of C<hyper> to
a preexisting C<Seq>.
a preexisting L<C<Seq>|/type/Seq>.

=head2 method invert

method invert(HyperSeq:D:)

Inverts the C<HyperSeq> created from a C<Seq> by C<.hyper>.
Inverts the C<HyperSeq> created from a L<C<Seq>|/type/Seq> by C<.hyper>.

=head2 method hyper

Expand All @@ -56,13 +56,13 @@ Returns the object.

method race(HyperSeq:D:)

Creates a C<RaceSeq> object out of the current one.
Creates a L<C<RaceSeq>|/type/RaceSeq> object out of the current one.

=head2 method serial

multi method serial(HyperSeq:D:)

Converts the object to a C<Seq> and returns it.
Converts the object to a L<C<Seq>|/type/Seq> and returns it.

=head2 method is-lazy

Expand Down
28 changes: 14 additions & 14 deletions doc/Type/HyperWhatever.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,48 @@

class HyperWhatever { }

C<HyperWhatever> is very similar in functionality to L<Whatever|/type/Whatever>. The
C<HyperWhatever> is very similar in functionality to L<C<Whatever>|/type/Whatever>. The
difference lies in C<HyperWhatever> standing in for I<multiple> values, rather
than a single one.

=head1 Standalone term

Just like with L<Whatever|/type/Whatever>, if a
L<HyperWhatever|/type/HyperWhatever> is used as a term on its own, no priming
is done and the L<HyperWhatever|/type/HyperWhatever> object will be used as-is:
Just like with L<C<Whatever>|/type/Whatever>, if a
C<HyperWhatever> is used as a term on its own, no priming
is done and the C<HyperWhatever> object will be used as-is:

sub foo ($arg) { say $arg.^name }
foo **; # OUTPUT: «HyperWhatever␤»

You can choose to interpret such a value as standing for multiple values in your
own routines. In core, a L<HyperWhatever|/type/HyperWhatever> can be used with
this meaning when smartmatching with L<Lists|/type/List>:
own routines. In core, a C<HyperWhatever> can be used with
this meaning when smartmatching with L<C<List>|/type/List>s:

say (1, 8) ~~ (1, **, 8); # OUTPUT: «True␤»
say (1, 2, 4, 5, 6, 7, 8) ~~ (1, **, 8); # OUTPUT: «True␤»
say (1, 2, 8, 9) ~~ (1, **, 8); # OUTPUT: «False␤»

Wherever a L<HyperWhatever|/type/HyperWhatever> appears in the list on the
Wherever a C<HyperWhatever> appears in the list on the
right-hand side means any number of elements can fill that space in the list
being smartmatched.

=head1 Priming

When it comes to priming, the L<HyperWhatever|/type/HyperWhatever> follows the
same rules as L<Whatever|/type/Whatever>. The only difference is
L<HyperWhatever|/type/HyperWhatever> produces a L<Callable|/type/Callable> with
When it comes to priming, the C<HyperWhatever> follows the
same rules as L<C<Whatever>|/type/Whatever>. The only difference is
C<HyperWhatever> produces a L<C<Callable>|/type/Callable> with
a L«C<*@> slurpy|/language/signatures#Flattened_slurpy» as a signature:

say (**²)(1, 2, 3, 4, 5); # OUTPUT: «(1 4 9 16 25)␤»

A L<HyperWhatever|/type/HyperWhatever> closure can be imagined as a
L«C<Whatever> closure|/type/WhateverCode» with another sub wrapped around it
A C<HyperWhatever> closure can be imagined as a
L«C<WhateverCode>|/type/WhateverCode» with B<another> sub wrapped around it
that simply maps each element in the arguments over:

my &hyper-whatever = sub (*@args) { map *², @args }
say hyper-whatever(1, 2, 3, 4, 5); # OUTPUT: «(1 4 9 16 25)␤»

When priming, mixing L<HyperWhatever|/type/HyperWhatever> with
L<Whatever|/type/Whatever> is not permitted.
When priming, mixing C<HyperWhatever> with
L<C<Whatever>|/type/Whatever> is not permitted.

=end pod

0 comments on commit 48ae15a

Please sign in to comment.