Skip to content

Commit

Permalink
Make xtest pass
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Jan 25, 2018
1 parent 0770f3a commit b023a9a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
10 changes: 6 additions & 4 deletions doc/Type/Routine.pod6
Expand Up @@ -181,24 +181,26 @@ The C<is pure> trait is a promise by the programmer to the compiler that it
can constant-fold
calls to such functions when the arguments are known at compile time.
sub syllabes() is pure {
say "Generating syllabes";
sub syllables() is pure {
say "Generating syllables";
my @vowels = <a e i o u>;
return @vowels.append: <k m n sh d r t y> X~ @vowels;
}
To see it an action with a particular compiler you can try this example:
=begin code :preamble<sub syllables {}>
BEGIN { say ‘Begin’ }
say ‘Start’;
say (^100).map: { syllabes().pick(2..5).join("") };
say (^100).map: { syllables().pick(2..5).join("") };
# Example output:
# Begin
# Generating syllabes
# Generating syllables
# Start
# (matiroi yeterani shoriyuru...
=end code
Essentially this allows the compiler to perform some operations at
Expand Down
4 changes: 2 additions & 2 deletions doc/Type/Signature.pod6
Expand Up @@ -239,8 +239,8 @@ sense for a routine to accept. This can be done with the C<:U> type
constraint, which checks the value passed if it is a I<type object>,
rather than an object instance.
sub can-turn-into(Str $þing, Any:U $type) {
return so $þing.$type;
sub can-turn-into(Str $string, Any:U $type) {
return so $string.$type;
}
say can-turn-into("3", Int);
say can-turn-into("6.5", Int);
Expand Down
3 changes: 3 additions & 0 deletions xt/code.pws
Expand Up @@ -242,6 +242,7 @@ majf
makequestionable
manymanymany
matchobject
matiroi
maybeval
mday
messageboxa
Expand Down Expand Up @@ -340,6 +341,7 @@ saysomething
setcallback
setgoal
sev
shoriyuru
shortname
skippingarray
sl
Expand Down Expand Up @@ -431,6 +433,7 @@ xoooo
xt
xyz
yday
yeterani
yourapp
yourmodule
yournick
Expand Down

0 comments on commit b023a9a

Please sign in to comment.