Skip to content

Commit

Permalink
Uniformize example output style
Browse files Browse the repository at this point in the history
And sync styleguide with this commonly adopted style
  • Loading branch information
stoned committed Jan 2, 2021
1 parent 3293842 commit 03945ee
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions doc/Language/grammar_tutorial.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ grammar Quoted-Other is Letters is Quote-Other {
my $quoted = q{"enhanced"};
my $parsed = Quoted-Quotes.parse($quoted);
say $parsed;
#OUTPUT:
# OUTPUT:
#「"enhanced"」
# quote => 「"」
# letters => 「enhanced」
Expand All @@ -286,7 +286,7 @@ say $parsed;
$quoted = "|barred|";
$parsed = Quoted-Other.parse($quoted);
say $parsed;
#OUTPUT:
# OUTPUT:
#|barred|」
#quote => 「|」
#letters => 「barred」
Expand Down
2 changes: 1 addition & 1 deletion doc/Language/iterating.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ my @longer-chain = DNA.new('ACGTACGTT');
say @longer-chain.raku;
# OUTPUT: «[("A", "C", "G"), ("T", "A", "C"), ("G", "T", "T")]␤»
say @longer-chain».join("").join("|"); #OUTPUT: «ACG|TAC|GTT␤»
say @longer-chain».join("").join("|"); # OUTPUT: «ACG|TAC|GTT␤»
=end code
In this example, which is an extension of the L<example in C<Iterable> that
Expand Down
8 changes: 4 additions & 4 deletions doc/Language/list.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ for @list -> @element {
say $sub-element;
}
}
# OUTPUT
# OUTPUT:
#1 2 3 → List
#1
#2
Expand Down Expand Up @@ -236,7 +236,7 @@ variable may B<not> be bound to a C<Seq>, and trying to do so will yield
an error.
my @s := <a b c>.Seq; CATCH { default { say .^name, ' ', .Str } }
# OUTPUT «X::TypeCheck::Binding Type check failed in binding; expected Positional but got Seq ($(("a", "b","c").Seq))␤»
# OUTPUT: «X::TypeCheck::Binding Type check failed in binding; expected Positional but got Seq ($(("a", "b","c").Seq))␤»
This is because the C<Seq> does not keep values around after you have
used them. This is useful behavior if you have a very long sequence, as
Expand Down Expand Up @@ -354,7 +354,7 @@ needed.
=for code
my $l := 1, 2, 4, 8 ... Inf;
say $l[0..16];
#OUTPUT: «(1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536)␤»
# OUTPUT: «(1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536)␤»
You can easily assign lazy objects to other objects, conserving their laziness:
Expand Down Expand Up @@ -500,7 +500,7 @@ structure in the result:
Slices can be taken also across several dimensions using I<semilists>, which are lists of slices separated by semicolons:
my @sliceable = [[ ^10 ], ['a'..'h'], ['Ⅰ'..'Ⅺ']];
say @sliceable[ ^3; 4..6 ]; #OUTPUT: «(4 5 6 e f g Ⅴ Ⅵ Ⅶ)␤»
say @sliceable[ ^3; 4..6 ]; # OUTPUT: «(4 5 6 e f g Ⅴ Ⅵ Ⅶ)␤»
which is selecting the 4 to 6th element from the three first dimensions (C<^3>).
Expand Down
4 changes: 2 additions & 2 deletions doc/Language/newline.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ You can change the default behavior for a particular handle by setting the
C<:nl-out> attribute when you create that handle.
my $crlf-out = open(IO::Special.new('<STDOUT>'), :nl-out("\\\n\r"));
$*OUT.say: 1; #OUTPUT: «1␤»
$crlf-out.say: 1; #OUTPUT: «1\␤␍»
$*OUT.say: 1; # OUTPUT: «1␤»
$crlf-out.say: 1; # OUTPUT: «1\␤␍»
In this example, where we are replicating standard output to a new handle by
using L<IO::Special|/type/IO::Special>, we are appending a C<\> to the end of
Expand Down
8 changes: 4 additions & 4 deletions doc/Language/objects.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -1257,8 +1257,8 @@ class B is A does M {
class C is A does M { }
B.new.f; # OUTPUT «I am in class B␤»
C.new.f; # OUTPUT «I am in role M␤»
B.new.f; # OUTPUT: «I am in class B␤»
C.new.f; # OUTPUT: «I am in role M␤»
=end code
Note that each candidate for a multi-method is its own method. In this case,
Expand All @@ -1279,8 +1279,8 @@ role Point {
method abs { sqrt($.x * $.x + $.y * $.y) }
method dimensions { 2 }
}
say Point.new(x => 6, y => 8).abs; # OUTPUT «10␤»
say Point.dimensions; # OUTPUT «2␤»
say Point.new(x => 6, y => 8).abs; # OUTPUT: «10␤»
say Point.dimensions; # OUTPUT: «2␤»
=end code
We call this automatic creation of classes I<punning>, and the generated class
Expand Down
2 changes: 1 addition & 1 deletion doc/Language/regexes.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ Notably C<.> also matches a logical newline C<\n>:
;
say $text ~~ / .* /;
# OUTPUT «「Although I am a␤multi-line text,␤I can be matched␤with /.*/.␤」»
# OUTPUT: «「Although I am a␤multi-line text,␤I can be matched␤with /.*/.␤」»
=head1 Character classes
Expand Down
6 changes: 3 additions & 3 deletions doc/Type/Any.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ The C<:as> and C<:with> parameters receive functions that are used for
transforming the item before checking equality, and for checking equality, since
by default the L<C<===>|/routine/===> operator is used:
("1", 1, "1 ", 2).unique( as => Int, with => &[==] ).say; #OUTPUT: «(1 2)␤»
("1", 1, "1 ", 2).unique( as => Int, with => &[==] ).say; # OUTPUT: «(1 2)␤»
Please see L<C<unique>|/language/independent-routines#routine_unique> for
additional examples that use its sub form.
Expand Down Expand Up @@ -911,7 +911,7 @@ argument or C<===> by default.
=for code
"aabbccddaa".comb.squish.say; # OUTPUT: «(a b c d a)␤»
"aABbccdDaa".comb.squish( :as(&lc) ).say; # OUTPUT: «(a B c d a)␤»
(3+2i,3+3i,4+0i).squish( as => *.re, with => &[==]).put; #OUTPUT: «3+2i 4+0i␤»
(3+2i,3+3i,4+0i).squish( as => *.re, with => &[==]).put; # OUTPUT: «3+2i 4+0i␤»
As shown in the last example, a sequence can contain a single element. See
L<C<squish>|/language/independent-routines#routine_squish> for additional C<sub>
Expand Down Expand Up @@ -1449,7 +1449,7 @@ any ties by checking the codepoint values of the strings, we get B<Same> back
for B<A> and B<a>:
$*COLLATION.set(:quaternary(False), :tertiary(False));
say 'a' coll 'A'; #OUTPUT: «Same␤»
say 'a' coll 'A'; # OUTPUT: «Same␤»
say ('a','A').collate == ('A','a').collate; # OUTPUT: «True␤»
The variable affects the L<C<coll>|/routine/coll> operator as shown as well as
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/Associative.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ coerced to C<Str> by default. This is the class used as second parameter when
you use the parameterized version of Associative.
my %any-hash;
%any-hash.keyof; #OUTPUT: «(Str(Any))␤»
%any-hash.keyof; # OUTPUT: «(Str(Any))␤»
=head1 Methods that should be provided
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/Compiler.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Since Rakudo version 2020.02, returns the name of the compiler's backend.
Up to Rakudo version 2019.03.1, it returned the date when it was built.
say $*PERL.compiler.build-date; #OUTPUT: «2018-05-05T21:49:43Z␤»
say $*PERL.compiler.build-date; # OUTPUT: «2018-05-05T21:49:43Z␤»
=head2 method verbose-config
Expand Down
6 changes: 3 additions & 3 deletions doc/Type/Grammar.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sole positional argument.
my $actions = class { method TOP($/) { say "7" } };
grammar { token TOP { a { say "42" } b } }.parse('ab', :$actions);
# OUTPUT : «42␤7␤»
# OUTPUT: «42␤7␤»
Additional named arguments are used as options for matching, so you can for example specify
things like C<:pos(4)> to start parsing from the fifth (:pos is zero-based) character.
Expand All @@ -65,7 +65,7 @@ those adverbs that affect the runtime behavior, such as C<:pos> and C<:continue>
=for code :preamble<grammar RepeatChar {}>
say RepeatChar.parse('bbbbbb', :rule('start'), :args(\('b')), :pos(4)).Str;
# OUTPUT : «bb␤»
# OUTPUT: «bb␤»
Method C<parse> only succeeds if the cursor has arrived at the end of the
target string when the match is over. Use L<method subparse|/routine/subparse>
Expand Down Expand Up @@ -135,7 +135,7 @@ are passed on to L<method parse|/routine/parse>.
# zoffixznet
# MasterDuke17
# OUTPUT : «TimToady,lizmat,jnthn,moritz,zoffixznet,MasterDuke17␤»
# OUTPUT: «TimToady,lizmat,jnthn,moritz,zoffixznet,MasterDuke17␤»
=end pod

Expand Down
6 changes: 3 additions & 3 deletions doc/Type/IO/Handle.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ my $output = $PROCESS::OUT;
$PROCESS::OUT = $store;
.say for <one two three>;
$PROCESS::OUT = $output;
say $store.lines(); # OUTPUT «[one␤ two␤ three␤]»
say $store.lines(); # OUTPUT: «[one␤ two␤ three␤]»
=end code
In this example we are creating a simple C<WRITE> redirection which stores
Expand Down Expand Up @@ -1121,8 +1121,8 @@ class IO::Store is IO::Handle {
my $store := IO::Store.new();
$store.print( $_ ) for <one two three>;
say $store.read(3).decode; # OUTPUT «one␤»
say $store.read(3).decode; # OUTPUT «two␤»
say $store.read(3).decode; # OUTPUT: «one␤»
say $store.read(3).decode; # OUTPUT: «two␤»
=end code
In this case, we have programmed the two C<READ> and C<EOF> methods, as well as
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/IO/Path.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ which case the reported size is dependent on the operating system. The method
will L«C<fail>|/routine/fail» with C<X::IO::DoesNotExist> if the path points to
a non-existent filesystem entity.
say $*EXECUTABLE.IO.s; # OUTPUT : «467␤»
say $*EXECUTABLE.IO.s; # OUTPUT: «467␤»
=head2 method l
Expand Down
8 changes: 4 additions & 4 deletions doc/Type/Junction.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ my $odd = 1|3|5;
my $even = 2|4|6;
my $merged = $odd ~ $even;
say $merged; #OUTPUT: «any(12, 14, 16, 32, 34, 36, 52, 54, 56)␤»
say $merged; # OUTPUT: «any(12, 14, 16, 32, 34, 36, 52, 54, 56)␤»
say "Found 34!" if 34 == $merged; #OUTPUT: «Found 34!␤»
say "Found 34!" if 34 == $merged; # OUTPUT: «Found 34!␤»
my $prefixed = "0" ~ $odd;
say "Found 03" if "03" == $prefixed; #OUTPUT: «Found 03!␤»
say "Found 03" if "03" == $prefixed; # OUTPUT: «Found 03!␤»
my $postfixed = $odd ~ "1";
say "Found 11" if 11 == $postfixed; #OUTPUT: «Found 11!␤»
say "Found 11" if 11 == $postfixed; # OUTPUT: «Found 11!␤»
=end code
On the other hand, the versions of C<~> that use a string as one argument will
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/PseudoStash.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ hash.
my $a = 42;
my $b = q/$a/;
say MY::{$b};
#OUTPUT: «42␤»
# OUTPUT: «42␤»
This shows how you can use a C<PseudoStash> to look up variables, by name,
at runtime.
Expand Down
2 changes: 1 addition & 1 deletion writing-docs/STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ in a given situation, please try to follow these guidelines.
When generating output in examples intended to be read by a user, use 'say'.
Additionally, add a comment showing the intended output, e.g.:

say 3.^name; #OUTPUT: «Int␤»
say 3.^name; # OUTPUT: «Int␤»

For examples where a particular format is required, or exact data is expected
(e.g., for something sent over a network connection), prefer 'put'.
Expand Down

0 comments on commit 03945ee

Please sign in to comment.