Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

96 lines (83 sloc) 2.655 kb
=begin pod
=TITLE Cool
class Cool is Any { }
C<Cool>, also known as the B<C>onvenient B<OO> B<L>oop, is a base class
for strings, numbers and other built-in classes that you are supposed to use
mostly interchangably.
Methods in C<Cool> coerce the invocant to a more
specific type, and then call the same method on that type. For example both
L<Int> and L<Str> inherit from C<Cool>, and calling method C<substr> on an
C<Int> converts the integer to C<Str> first.
123.substr(1, 1); # '2', same as 123.Str.substr(1, 1)
The following built-in types inherit from C<Cool>:
L<Array> L<Backtrace> L<Bag> L<Baggy> L<Bool> L<Complex> L<Cool>
L<Duration> L<Enumeration> L<EnumMap> L<FatRat> L<Hash> L<Instant>
L<Int> L<Iterable> L<Iterator> L<KeyHash> L<KeySet> L<List>
L<ListIter> L<LoL> L<MapIter> L<Nil> L<Num> L<Numeric> L<Parcel>
L<Range> L<Real> L<Seq> L<Set> L<Stash> L<Str> L<Stringy>
The following table summarizes the methods that C<Cool> provides, and
what type they coerce to:
=begin table
method coercion type
abs Numeric
conj Numeric
sqrt Numeric
sign Numeric
rand Numeric
sin Numeric
asin Numeric
cos Numeric
acos Numeric
tan Numeric
atan Numeric
atan2 Numeric
sec Numeric
asec Numeric
cosec Numeric
acosec Numeric
cotan Numeric
acotan Numeric
sinh Numeric
asinh Numeric
cosh Numeric
acosh Numeric
sech Numeric
asech Numeric
asech Numeric
cosech Numeric
acotanh Numeric
cis Numeric
log Numeric
exp Numeric
roots Numeric
log10 Numeric
unpolar Numeric
round Numeric
floor Numeric
ceiling Numeric
truncate Numeric
ord Int
chars Str
fmt Str
uc Str
lc Str
capitalize Str
fc Str
flip Str
trans Str
index Str
rindex Str
ords Str
split Str
match Str
comb Str
subst Str
sprintf Str
printf Str
samecase Str
trim Str
trim-leading Str
trim-trailing Str
eval Str
=end table
=end pod
Jump to Line
Something went wrong with that request. Please try again.