Skip to content

Commit

Permalink
Adds content to the sequences section
Browse files Browse the repository at this point in the history
Also learns new words. Refs #114
  • Loading branch information
JJ committed May 25, 2018
1 parent 34ec3dc commit d670de3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
13 changes: 12 additions & 1 deletion doc/Language/math.pod6
Expand Up @@ -94,7 +94,7 @@ Which makes also arithmetic operations the most adequate for the particular type
say .33-.22-.11 == 0; # OUTPUT: «True␤»
In this case, all numbers are intepreted as C<Rat>s, which makes the operation exact. In general, most languages would interpret them as floating point numbers,
In this case, all numbers are interpreted as C<Rat>s, which makes the operation exact. In general, most languages would interpret them as floating point numbers,
say .33.Num -.22.Num - .11.Num; # OUTPUT: «1.3877787807814457e-17␤»
Expand Down Expand Up @@ -136,6 +136,17 @@ We can, in fact, compute the approximation to the L<golden ratio|https://en.wiki
The L<Math::Sequences|https://github.com/ajs/perl6-Math-Sequences> module includes many mathematical sequences, already defined for you. It defines many L<sequences from the encyclopedia|https://oeis.org/>, some of them with their original name, such as ℤ or ℝ.
Some set operators also operate on sequences, and they can be used to find out if an object is part of it:
say 876 ∈ (7,14 … * > 1000) ; # OUTPUT: «False␤»
In this particular case, we can find out if C<876> is a multiple of 7 straight away, but the same principle holds for other sequences using complicated generators. And we can use set inclusion operators too:
say (55,89).Set ⊂ (1,1, * + * … * > 200); # OUTPUT: «True␤»
although it does not take into account if it is effectively a subsequence, just the presence of the two elements here; Sets have no order, and even if you don't explicitly cast the subsequence into a Set or explicitly cast it into a C<Seq> it will be coerced into such for the application of the inclusion operator.
=head1 Mathematical constants
Perl 6 includes already a set of mathematical constants as part of the core.
Expand Down
27 changes: 14 additions & 13 deletions xt/words.pws
@@ -1,3 +1,4 @@
Planck's
ShiftJIS
abi
absolutepath
Expand Down Expand Up @@ -302,6 +303,7 @@ dmg
documentable
documentables
doesnotexist
dpkg
dsl
dsls
dt
Expand Down Expand Up @@ -337,6 +339,7 @@ env
eof
eol
eq
equalities
eqv
erlang
errno
Expand Down Expand Up @@ -815,6 +818,7 @@ orwith
osname
osr
osrs
otherphi
oub
oublock
outblock
Expand Down Expand Up @@ -858,6 +862,7 @@ perlvar
pgrp
phaser
phasers
phi
photoshop
php
pickpairs
Expand Down Expand Up @@ -933,6 +938,7 @@ quaggas
quanthash
quantifiervalue
quasiquoting
quaternion
queueing
queuesize
quickstart
Expand Down Expand Up @@ -1170,6 +1176,7 @@ subscriptable
subscripted
subscripting
subsep
subsequence
subsignatures
subst
substr
Expand Down Expand Up @@ -1379,6 +1386,12 @@ wraphandle
writehandle
wrongorder
ws
xFA
xFB
xFC
xFD
xFE
xFEZ
xcompose
xdigit
xeqv
Expand All @@ -1395,16 +1408,4 @@ yot
yyyy
zef
zoffixznet
zwj
xFE
xFEZ
xFA
xFB
xFC
xFD
dpkg
equalities
quaternion
phi
otherphi
Planck's
zwj

0 comments on commit d670de3

Please sign in to comment.