Skip to content

Instantly share code, notes, and snippets.

@KamilaBorowska
Created July 30, 2012 18:55
Show Gist options
  • Save KamilaBorowska/3209151 to your computer and use it in GitHub Desktop.
Save KamilaBorowska/3209151 to your computer and use it in GitHub Desktop.
Str.wordcase (Perl 6) http://doc.perl6.org/type/Str#wordcase Performs a Unicode titlecase operation on the first character of each word of the string (as defined by a regex « boundary), and forces the rest of the letters through a filter that defaults to lc. After this operation, if any exceptions are supplied and if the word is found in the set of exceptions, the first character is also forced through the filter. Note that the exceptions must be spelled with an initial titlecase, such as "By" or "And", to produce "by" or "and". multi sub wordcase(Str:D :&filter = &lc, :%exceptions = set()) returns Str\nmulti method wordcase(Str:D: :&filter = &lc, :%exceptions = set()) returns Str
Date.day-of-year (Perl 6) http://doc.perl6.org/type/Date#day-of-year Returns the day of the year (1..366). method day-of-year(Date:D:) returns Int:D
List.shift (Perl 6) http://doc.perl6.org/type/List#shift Removes and returns the first item from the list, fails for an empty list. multi sub shift(List:D )\nmulti method shift(List:D:)
Parameter.slurpy (Perl 6) http://doc.perl6.org/type/Parameter#slurpy Returns True for slurpy parameters
Pair.cmp (Perl 6) http://doc.perl6.org/type/Pair#cmp The type-agnostic comparator; compares two Pairs. Compares first their key parts, and then compares the value parts if the keys are equal. multi sub infix:<cmp>(Pair:D, Pair:D)
Rational.numerator (Perl 6) http://doc.perl6.org/type/Rational#numerator Returns the numerator. method numerator(Rational:D:) returns NuT:D
Mu.print (Perl 6) http://doc.perl6.org/type/Mu#print Prints value to $*OUT after stringification using .Str method without newline at end. multi method print() returns Bool:D
Numeric.exp (Perl 6) http://doc.perl6.org/type/Numeric#exp Returns $base to the power of the number, or e to the power of the number if called without a second argument. multi sub exp(Numeric:D, Numeric:D $base = e) returns Numeric:D\nmulti method exp(Numeric:D: Numeric:D $base = e) returns Numeric:D
Match.hash (Perl 6) http://doc.perl6.org/type/Match#hash Returns a hash of named submatches.
Match.ast (Perl 6) http://doc.perl6.org/type/Match#ast Returns the AST (ie payload).
Bool.prefix:<so> (Perl 6) http://doc.perl6.org/type/Bool#prefix%3A%3Cso%3E Coerces its argument to Bool, has looser precedence than < prefix:<? >>. multi sub prefix:<so>(Mu) returns Bool:D
Complex.polar (Perl 6) http://doc.perl6.org/type/Complex#polar Returns a two-element list of the polar coordinates for this value, ie magnitude and angle in radians. method polar(Complex:D:) returns Positional:D
Version.parts (Perl 6) http://doc.perl6.org/type/Version#parts Returns the list of parts that make up this Version object method parts(Version:D:) returns List:D
Backtrace.full (Perl 6) http://doc.perl6.org/type/Backtrace#full Returns a full string representation of the backtrace, including hidden frames, compiler-specific frames and those from the setting. multi method full(Backtrace:D:) returns Str:D:
IO.modified (Perl 6) http://doc.perl6.org/type/IO#modified Timestamp when the file was last modified. "path/to/file".IO.modified()
Enum.value (Perl 6) http://doc.perl6.org/type/Enum#value Returns the value part of the Enum. multi method value(Enum:D:)
Pair.value (Perl 6) http://doc.perl6.org/type/Pair#value Returns the value part of the Pair. multi method value(Pair:D:) is rw
Str.tclc (Perl 6) http://doc.perl6.org/type/Str#tclc Turns the first character to title case, and all other characters to lower case multi sub tclc(Str:D ) returns Str:D\nmulti method tclc(Str:D:) returns Str:D
Complex.isNaN (Perl 6) http://doc.perl6.org/type/Complex#isNaN Returns true if the real or imaginary part is NaN (not a number). method isNaN(Complex:D:) returns Bool:D
List.sort (Perl 6) http://doc.perl6.org/type/List#sort Sorts the list, smallest element first. By default < infix:<cmp >> is used for comparing list elements. multi sub sort(*@elems) returns List:D\nmulti sub sort(&by, *@elems) returns List:D\nmulti method sort(List:D:) returns List:D\nmulti method sort(List:D:, &by) returns List:D
List.end (Perl 6) http://doc.perl6.org/type/List#end Returns the index of the last element. multi sub end($list) returns Int:D\nmulti method end(List:D:) returns Int:D
Parameter.positional (Perl 6) http://doc.perl6.org/type/Parameter#positional Returns True if the parameter is positional.
Mu.defined (Perl 6) http://doc.perl6.org/type/Mu#defined Returns False on the type object, and True otherwise multi sub defined(Mu) returns Bool:D\nmulti method defined() returns Bool:D
Str.ucfirst (Perl 6) http://doc.perl6.org/type/Str#ucfirst Perl 6 does not have a ucfirst function. See X<tc>.
Str.chars (Perl 6) http://doc.perl6.org/type/Str#chars Returns the number of characters in the string in the current (lexically scoped) idea of what a normal character is, usually graphemes. multi sub chars(Str:D ) returns Int:D\nmulti method chars(Str:D:) returns Int:D
Range.min (Perl 6) http://doc.perl6.org/type/Range#min Returns the start point of the range. method min(Range:D:)
Mu.gist (Perl 6) http://doc.perl6.org/type/Mu#gist Returns a string representation of the invocant, optimized for fast recognition by humans. multi sub gist(Mu) returns Str\nmulti method gist() returns Str
Date.gist (Perl 6) http://doc.perl6.org/type/Date#gist Returns the date in YYYY-MM-DD format (ISO 8601) multi method gist(Date:D:) returns Str:D
Exception.gist (Perl 6) http://doc.perl6.org/type/Exception#gist Returns whatever the exception printer should produce for this exception. The default implementation returns message and backtrace separated by a newline. multi method gist(Exception:D:)
Str.ord (Perl 6) http://doc.perl6.org/type/Str#ord Returns the codepoint number of the first character of the string multi sub ord (Str:D) returns Int:D\nmulti method ord(Str:D:) returns Int:D
Str.lc (Perl 6) http://doc.perl6.org/type/Str#lc Returns a lower-case version of the string. multi sub lc(Str:D ) returns Str:D\nmulti method lc(Str:D:) returns Str:D
Numeric.abs (Perl 6) http://doc.perl6.org/type/Numeric#abs Returns the absolute value of the number. multi sub abs(Numeric:D ) returns Real:D\nmulti method abs(Numeric:D:) returns Real:D
Str.tc (Perl 6) http://doc.perl6.org/type/Str#tc Does a Unicode "titlecase" operation, that is changes the first character in the string to title case, or to upper case if the character has no title case mapping multi sub tc(Str:D ) returns Str:D\nmulti method tc(Str:D:) returns Str:D
Backtrace::Frame.is-setting (Perl 6) http://doc.perl6.org/type/Backtrace%3A%3AFrame#is-setting Returns True if the frame is part of a setting. method is-setting(Backtrace::Frame:D) return Bool:D
Numeric.sqrt (Perl 6) http://doc.perl6.org/type/Numeric#sqrt Returns a square root of the number. For real numbers the positive square root is returned. mulit sub sqrt(Numeric:D) returns Numeric:D\nmulit method sqrt(Numeric:D) returns Numeric:D
List.pairs (Perl 6) http://doc.perl6.org/type/List#pairs Returns a list of pairs, with the indexes as keys and the list values as values. multi sub pairs($list) returns List:D\nmulti method pairs(List:D:) returns List:D
Pair.pairs (Perl 6) http://doc.perl6.org/type/Pair#pairs Returns a list of one Pair, namely this one. multi method pairs(Pair:D:)
EnumMap.pairs (Perl 6) http://doc.perl6.org/type/EnumMap#pairs Returns a list of all pairs in the EnumMap. method pairs(EnumMap:D:) returns List:D
Match.to (Perl 6) http://doc.perl6.org/type/Match#to Returns the index of the end position of the match.
Numeric.Real (Perl 6) http://doc.perl6.org/type/Numeric#Real If this Numeric is equivalent to a Real, return that Real. Fail with X::Numeric::Real otherwise. method Real(Numeric:D:) returns Real:D
Parameter.rw (Perl 6) http://doc.perl6.org/type/Parameter#rw Returns True for is rw parameters
Mu.ACCEPTS (Perl 6) http://doc.perl6.org/type/Mu#ACCEPTS Performs a type check. Returns True if $other conforms to the invocant (which is always a type object or failure). multi method ACCEPTS(Mu:U: $other)
Any.ACCEPTS (Perl 6) http://doc.perl6.org/type/Any#ACCEPTS Returns True if $other === self (ie it checks object identity). multi method ACCEPTS(Any:D: Mu $other)
Code.ACCEPTS (Perl 6) http://doc.perl6.org/type/Code#ACCEPTS Usually calls the code object and passes $topic as an argument. However, when called on a code object that takes no arguments, the code object is invoked with no arguments and $topic is dropped. The result of the call is returned. multi method ACCEPTS(Code:D: Mu $topic)
Numeric.ACCEPTS (Perl 6) http://doc.perl6.org/type/Numeric#ACCEPTS Returns True if $other is numerically the same as the invocant. multi method ACCEPTS(Numeric:D: $other)
EnumMap.ACCEPTS (Perl 6) http://doc.perl6.org/type/EnumMap#ACCEPTS Used in smart-matching if the right-hand side is an EnumMap. multi method ACCEPTS(EnumMap:D: Positional $topic)\nmulti method ACCEPTS(EnumMap:D: Cool:D $topic)\nmulti method ACCEPTS(EnumMap:D: Regex $topic)\nmulti method ACCEPTS(EnumMap:D: Any $topic)
Str.trim-trailing (Perl 6) http://doc.perl6.org/type/Str#trim-trailing Remove the white-space charecters from the end of a string. See also trim.
Mu.perl (Perl 6) http://doc.perl6.org/type/Mu#perl Returns a Perlish representation of the object (i.e., can usually be reparsed to regenerate the object). multi sub perl(Mu) returns Str\nmulti method perl() returns Str
Date.year (Perl 6) http://doc.perl6.org/type/Date#year Returns the year of the date method year(Date:D:) returns Int:D
Range.excludes_max (Perl 6) http://doc.perl6.org/type/Range#excludes_max Returns True if the end point is excluded from the range, and False otherwise. method excludes_max(Range:D:) returns Bool:D
Str.chomp (Perl 6) http://doc.perl6.org/type/Str#chomp Returns the string with a logical newline removed from the end. multi sub chomp(Str:D ) returns Str:D\nmulti method chomp(Str:D:) returns Str:D
Match.prematch (Perl 6) http://doc.perl6.org/type/Match#prematch Returns the part of the original string in front of the match.
Mu.bless (Perl 6) http://doc.perl6.org/type/Mu#bless Lower-level object construction method than new. method bless(Mu $candidate, *%attrinit) returns Mu:D
Str.encode (Perl 6) http://doc.perl6.org/type/Str#encode Returns a Buf which represents the original string in the given encoding and normal form. The actual return type is as specific as possible, so $str.encode('UTF-8') returns a utf8 object, $str.encode('ISO-8859-1') a buf8. multi method encode(Str:D: $encoding = $?ENC, $nf = $?NF) returns Buf
Mu.say (Perl 6) http://doc.perl6.org/type/Mu#say Prints value to $*OUT after stringification using .gist method with newline at end. multi method say() returns Bool:D
Date.is-leap-year (Perl 6) http://doc.perl6.org/type/Date#is-leap-year Returns True if $year is a leap year. Can be called as a class method if the year is provided. method is-leap-year($year = self.year) returns Bool:D
Parameter.readonly (Perl 6) http://doc.perl6.org/type/Parameter#readonly Returns True for read-only parameters (the default)
Version.plus (Perl 6) http://doc.perl6.org/type/Version#plus Returns True if comparisons against this version allow larger versions too. method plus(Version:D:) returns Bool:D
Mu.Bool (Perl 6) http://doc.perl6.org/type/Mu#Bool Returns False on the type object, and True otherwise multi sub Bool(Mu) returns Bool:D\nmulti method Bool() returns Bool:D
Numeric.Bool (Perl 6) http://doc.perl6.org/type/Numeric#Bool Returns False if the number is equivalent to zero, and True otherwise. multi method Bool(Numeric:D:)
Buf.Bool (Perl 6) http://doc.perl6.org/type/Buf#Bool Returns False if and only if the buffer is empty. multi method Bool(Buf:D:)
List.Bool (Perl 6) http://doc.perl6.org/type/List#Bool Returns True if the list has at least one element, and False for the empty list. multi method Bool(List:D:) returns Bool:D
Buf.elems (Perl 6) http://doc.perl6.org/type/Buf#elems Returns the number of elements of the buffer. multi method elems(Buf:D:) returns Int:D
List.elems (Perl 6) http://doc.perl6.org/type/List#elems Returns the number of elements in the list. multi sub elems($list) returns Int:D\nmulti method elems(List:D:) returns Int:D
EnumMap.elems (Perl 6) http://doc.perl6.org/type/EnumMap#elems Returns the number of pairs stored in the EnumMap. method elems(EnumMap:D:) returns Int:D:
Parameter.type (Perl 6) http://doc.perl6.org/type/Parameter#type Returns the nominal type constraint of the paramter
Exception.fail (Perl 6) http://doc.perl6.org/type/Exception#fail Same as fail $exception; i.e., it exits the calling Routine and returns the exception wrapped in a Failure object. method fail(Exception:D:)
Date.days-in-month (Perl 6) http://doc.perl6.org/type/Date#days-in-month Returns the number of days in a month, where year and month default to that of the invocant. If both year and month are provided, it can be called as a class method. method days-in-month(year = self.year, month = self.month) returns Int:D
Date.prev (Perl 6) http://doc.perl6.org/type/Date#prev Returns the previous day method prev(Date:D:) return Date:D
Int.chr (Perl 6) http://doc.perl6.org/type/Int#chr Returns a one-character string, by interpreting the integer as a Unicode codepoint number and converting it the corresponding character. multi sub chr(Int:D ) returns Str:D\nmulti method chr(Int:D:) returns Str:D
List.roll (Perl 6) http://doc.perl6.org/type/List#roll Returns a lazy list of $count elements, each randomly selected from the list. Each random choice is made indepently, like a separate die roll where each die face is a list element. multi method roll(List:D: $count = 1)
Any.any (Perl 6) http://doc.perl6.org/type/Any#any Interprets the invocant as a list and creates an any-Junction from it.
Numeric.conj (Perl 6) http://doc.perl6.org/type/Numeric#conj Returns the complex conjugate of the number. Returns the number itself for real numbers. multi method conj(Numeric:D) returns Numeric:D
Mu.Str (Perl 6) http://doc.perl6.org/type/Mu#Str Returns a string representation of the invocant, intended to be machine readable. multi method Str() returns Str
Code.Str (Perl 6) http://doc.perl6.org/type/Code#Str Returns the name of the code object. multi method Str(Code:D:) returns Str:D
Match.Str (Perl 6) http://doc.perl6.org/type/Match#Str Returns the matched text.
Date.Str (Perl 6) http://doc.perl6.org/type/Date#Str Returns the date in YYYY-MM-DD format (ISO 8601) multi method Str(Date:D:) returns Str:D
List.Str (Perl 6) http://doc.perl6.org/type/List#Str Stringifies the elements of the list and joins them with spaces (same as .join(' ')). multi method Str(List:D:) returns Str:D
Backtrace.Str (Perl 6) http://doc.perl6.org/type/Backtrace#Str Returns a concise string representation of the backtrace, omitting routines marked as is hidden_from_backtrace, and at the discretion of the implementor, also some routines from the setting. multi method Str(Backtrace:D:) returns Str:D:
Range.bounds (Perl 6) http://doc.perl6.org/type/Range#bounds Returns a list consisting of the start and end point. method bounds(Range:D:) returns Positional
Rational.denominator (Perl 6) http://doc.perl6.org/type/Rational#denominator Returns the denominator. method denominator(Rational:D:) returns DenomT:D
IO.accessed (Perl 6) http://doc.perl6.org/type/IO#accessed Timestamp when the file was last accessed. "path/to/file".IO.accessed()
Match.postmatch (Perl 6) http://doc.perl6.org/type/Match#postmatch Returns the part of the original string behind the match.
Str.fc (Perl 6) http://doc.perl6.org/type/Str#fc Does a Unicode "fold case" operation suitable for doing caseless string comparisons. (In general, the returned string is unlikely to be useful for any purpose other than comparison.) multi sub fc(Str:D ) returns Str:D\nmulti method fc(Str:D:) returns Str:D
Code.count (Perl 6) http://doc.perl6.org/type/Code#count Returns the maximum number of positional arguments that may be passed when calling the code object. For code objects that can accept any number of positional arguments (that is, they have a slurpy parameter), count will return Inf. Named parameters do not contribute. method count(Code:D:) returns Real:D
Signature.count (Perl 6) http://doc.perl6.org/type/Signature#count Returns the maximal number of positional arguments which can be bound to the signature. Returns Inf if there is a slurpy positional parameter. method count(Signature:D:) returns Real:D
Str.length (Perl 6) http://doc.perl6.org/type/Str#length Perl 6 does not have a length function. See X<chars> or X<elems>.
Parameter.default (Perl 6) http://doc.perl6.org/type/Parameter#default Returns a closure that upon invocation returns the default value for this paraemter, or Any if no default was provided.
Backtrace::Frame.subname (Perl 6) http://doc.perl6.org/type/Backtrace%3A%3AFrame#subname Returns the name of the enclosing subroutine. method subname(Backtrace::Frame:D) returns Str
Str.split (Perl 6) http://doc.perl6.org/type/Str#split Splits a string up into pieces based on delimiters found in the string. multi sub split( Str:D $delimiter, Str:D $input, $limit = Inf, :$all) returns Positional\nmulti sub split(Regex:D $delimiter, Str:D $input, $limit = Inf, :$all) returns Positional
List.values (Perl 6) http://doc.perl6.org/type/List#values Returns a copy of the list. multi sub values($list) returns List:D\nmulti method values(List:D:) returns List:D
EnumMap.values (Perl 6) http://doc.perl6.org/type/EnumMap#values Returns a list of all values in the EnumMap. method values(EnumMap:D:) returns List:D
Exception.backtrace (Perl 6) http://doc.perl6.org/type/Exception#backtrace Returns the backtrace associated with the exception. Only makes sense on exceptions that have been thrown at least once. method backtrace(Exception:D:) returns Backtrace:D
List.kv (Perl 6) http://doc.perl6.org/type/List#kv Returns an interleaved list of indexes and values. For example multi sub kv($list) returns List:D\nmulti method kv(List:D:) returns List:D
Pair.kv (Perl 6) http://doc.perl6.org/type/Pair#kv Returns a two-element Parcel with the key and value parts o Pair, in that order. This method is a special case of the same-named method on Hash, which returns all its entries as a list of keys and values. multi method kv(Pair:D:) returns Parcel:D
EnumMap.kv (Perl 6) http://doc.perl6.org/type/EnumMap#kv Returns a list of keys and values interleaved. method kv(EnumMap:D:) returns List:D
Str.chop (Perl 6) http://doc.perl6.org/type/Str#chop Returns the string with one character removed from the end. multi sub chop(Str:D) returns Str:D\nmulti method chop(Str:D:) returns Str:D
List.reverse (Perl 6) http://doc.perl6.org/type/List#reverse Returns a list with the elements in reverse order. multi sub reverse(*@list ) returns List:D\nmulti method reverse(List:D:) returns List:D
Str.sprintf (Perl 6) http://doc.perl6.org/type/Str#sprintf This function is mostly identical to the C library sprintf function. multi sub sprintf ( Str:D $format, *@args) returns Str:D
Real.ceiling (Perl 6) http://doc.perl6.org/type/Real#ceiling Returns the smallest integer not less than the number. method ceiling(Real:D) returns Int:D
Code.arity (Perl 6) http://doc.perl6.org/type/Code#arity Returns the minimum number of positional arguments that must be passed in order to call the code object. Any optional or slurpy parameters in the code object's Signature do not contribute, nor do named parameters. method arity(Code:D:) returns Int:D
Signature.arity (Perl 6) http://doc.perl6.org/type/Signature#arity Returns the minimal number of positional arguments required to satisfy the signature. method arity(Signature:D:) returns Int:D
Pair.fmt (Perl 6) http://doc.perl6.org/type/Pair#fmt Takes a format string, and returns a string the key and value parts of the Pair formatted. Here's an example: multi method fmt(Pair:D:) returns Str:D
Real.base (Perl 6) http://doc.perl6.org/type/Real#base Converts the number to a string, using $base as base. For $base larger than ten, capital latin letters are used. method base(Real:D: Int:D $base where 2..36) returns Str:D
Date.day-of-month (Perl 6) http://doc.perl6.org/type/Date#day-of-month Returns the day of the month of the date (1..31). Synonymous to the day method. method day-of-month(Date:D:) returns Int:D
Numeric.log10 (Perl 6) http://doc.perl6.org/type/Numeric#log10 Calculates the logarithm to base 10. multi sub log10(Numeric:D ) returns Numeric:D\nmulti method log10(Numeric:D:) returns Numeric:D
Real.sign (Perl 6) http://doc.perl6.org/type/Real#sign Returns -1 if the number is negative, 0 if it is zero and 1 otherwise. method sign(Real:D:)
Rational.norm (Perl 6) http://doc.perl6.org/type/Rational#norm Returns a normalized Rational object, ie with positive denominator, and numerator and denominator coprime. method norm(Rational:D:) returns Rational:D
Enum.invert (Perl 6) http://doc.perl6.org/type/Enum#invert Returns a new Enum with the original enum's value as the key, and the original enum's key as value. multi method invert(Enum:D:) returns Enum:D
EnumMap.invert (Perl 6) http://doc.perl6.org/type/EnumMap#invert Returns a list of pairs, but with key and value exchanged. method invert(EnumMap:D:) returns List:D
IO.dir (Perl 6) http://doc.perl6.org/type/IO#dir Returns a list of IO::File and IO::Dir objects for the files and directories found in the $path. If $path is not given assumes the current directory. sub dir Cool $path = '.', Mu :$test = none('.', '..')
Parameter.type_captures (Perl 6) http://doc.perl6.org/type/Parameter#type_captures Returns a list of variable names of type captures associated with this parameter sub a(::T ::U $x) { }\nsay &a.signature.params[0].type_captures; # T U
Complex.re (Perl 6) http://doc.perl6.org/type/Complex#re Returns the real part of the complex number. method re(Complex:D:) returns Real:D
Match.list (Perl 6) http://doc.perl6.org/type/Match#list Returns a list of positional submatches.
Range.list (Perl 6) http://doc.perl6.org/type/Range#list Generates the list of elements that the range represents. method list(Range:D:) returns List:D
Str.trim (Perl 6) http://doc.perl6.org/type/Str#trim Remove leading and trailing white-spces. It can be use both as a method on strings and as a function. When used as a method it will return the trimmed string. In order to do in-place trimming, once needs to write .=trim method trim(Str:D:) returns Str
Backtrace::Frame.code (Perl 6) http://doc.perl6.org/type/Backtrace%3A%3AFrame#code Returns the code object into which .file and .line point, if avaialble. method code(Backtrace::Frame:D)
Numeric.Num (Perl 6) http://doc.perl6.org/type/Numeric#Num If this Numeric is equivalent to a Real, return that Real as a Num as accurately as is possible. Fail with X::Numeric::Real otherwise. method Num(Numeric:D:) returns Num:D
List.map (Perl 6) http://doc.perl6.org/type/List#map Invokes &code for each element and gathers the return values in another list and returns it. This happens lazily, ie &code is only invoked when the return values are accessed. multi sub map(&code, *@elems) returns List:D\nmulti method map(List:D: &code) returns List:D
Range.max (Perl 6) http://doc.perl6.org/type/Range#max Returns the end point of the range. method max(Range:D:)
Parameter.invocant (Perl 6) http://doc.perl6.org/type/Parameter#invocant Returns True if the parameter is the invocant parameter.
Match.make (Perl 6) http://doc.perl6.org/type/Match#make Sets the AST to $ast, and returns it. method make(Match:D: Mu $ast)
Mu.CREATE (Perl 6) http://doc.perl6.org/type/Mu#CREATE Allocates a new object of the same type as the invocant, without initializating any attributes. method CREATE() returns Mu:D
Real.round (Perl 6) http://doc.perl6.org/type/Real#round Rounds the number to scale $scale. If $scale is 1, rounds to an integer. If scale is 0.1, rounds to one digit after the comma etc. method round(Real:D: $scale = 1)
Positional.of (Perl 6) http://doc.perl6.org/type/Positional#of Returns the type constraint for elements of the positional container. Defaults to Mu. method of()
List.push (Perl 6) http://doc.perl6.org/type/List#push Adds the @values to the end of the list, and returns the modified list. Fails for infinite lists. multi sub push(List:D, *@values) returns List:D\nmulti method push(List:D: *@values) returns List:D
Hash.push (Perl 6) http://doc.perl6.org/type/Hash#push Adds the @new elements to the hash with the same semantics as hash assignment, but with three exceptions: multi method push(Hash:D: *@new)
Parameter.copy (Perl 6) http://doc.perl6.org/type/Parameter#copy Returns True for is copy parameters
Any.one (Perl 6) http://doc.perl6.org/type/Any#one Interprets the invocant as a list and creates an one-Junction from it.
Numeric.Int (Perl 6) http://doc.perl6.org/type/Numeric#Int If this Numeric is equivalent to a Real, return the equivalent of calling truncate on that Real to get an Int. Fail with X::Numeric::Real otherwise. method Int(Numeric:D:) returns Int:D
List.Int (Perl 6) http://doc.perl6.org/type/List#Int Returns the number of elements in the list (same as .elems). multi method Int(List:D:) return Int:D
Exception.throw (Perl 6) http://doc.perl6.org/type/Exception#throw Throws the exception. method throw(Exception:D:)
Any.all (Perl 6) http://doc.perl6.org/type/Any#all Interprets the invocant as a list and creates an all-Junction from it.
Backtrace::Frame.file (Perl 6) http://doc.perl6.org/type/Backtrace%3A%3AFrame#file Returns the file name. method file(Backtrace::Frame:D) returns Str
Str.index (Perl 6) http://doc.perl6.org/type/Str#index Searches for $needle in the string starting from $startpos. It returns the offset into the string where $needle was found, and an undefined value if it was not found. multi sub index(Str:D, Str:D $needle, Int $startpos = 0) returns StrPos\nmulti method index(Str:D: Str:D $needle, Int $startpos = 0) returns StrPos
Str.ords (Perl 6) http://doc.perl6.org/type/Str#ords Returns a list of codepoint numbers, one for each character in the string. multi method ords(Str:D:) returns Positional
Real.truncate (Perl 6) http://doc.perl6.org/type/Real#truncate Rounds the number towards zero. method truncate(Real:D) returns Int:D
IO.prompt (Perl 6) http://doc.perl6.org/type/IO#prompt Prints out a string to the standard output and waits for the user to type in something and finish with an ENTER. Returns the string typed in without the trailing newline. my $name = prompt("Hi, what's your name?");
Date.day-of-week (Perl 6) http://doc.perl6.org/type/Date#day-of-week Returns the day of the week, where 0 is Sunday, 1 is Monday etc. method day-of-week(Date:D:) returns Int:D
Real.rand (Perl 6) http://doc.perl6.org/type/Real#rand Returns a pseudo-random number between zero and the number. sub term:<rand> returns Num:D\nmethod rand(Real:D:) returns Real:D
Str.uc (Perl 6) http://doc.perl6.org/type/Str#uc Returns an uppercase version of the string. multi sub uc(Str:D ) returns Str:D\nmulti method uc(Str:D:) returns Str:D
Any.none (Perl 6) http://doc.perl6.org/type/Any#none Interprets the invocant as a list and creates an none-Junction from it.
Exception.rethrow (Perl 6) http://doc.perl6.org/type/Exception#rethrow Rethrows an exception that has already been thrown at least once. This is different from throw in that it preserves the original backtrace. method rethrow(Exception:D:)
List.pick (Perl 6) http://doc.perl6.org/type/List#pick Returns $count elements chosen at random and without repetition from the invocant. If * is passed as $count, all elements from the invocant list are returned in a random sequence. multi method pick(List:D: $count = 1)
Str.substr (Perl 6) http://doc.perl6.org/type/Str#substr Returns a part of the string, starting from the character with index $from (where the first character has index 0) and with length $chars. multi sub substr(Str:D $s, Int:D $from, Int:D $chars = $s.chars - $from) returns Str:D\nmulti method substr(Str:D $s: Int:D $from, Int:D $chars = $s.chars - $from) returns Str:D
Str.pred (Perl 6) http://doc.perl6.org/type/Str#pred Returns the string decremented by one. method pred(Str:D:) returns Str:D
Numeric.pred (Perl 6) http://doc.perl6.org/type/Numeric#pred Returns the number decremented by one (predecessor). method pred(Numerid:D:)
Str.trim-leading (Perl 6) http://doc.perl6.org/type/Str#trim-leading Remove the white-space charecters from the beginning of a string. See also trim.
List.eager (Perl 6) http://doc.perl6.org/type/List#eager Evaluates all elements in the list eagerly, and returns the invocant. If a List signals that it is "known infinite", eager evaluation may stop at the point where the infinity is detected. multi method eager(List:D:) returns List:D
List.keys (Perl 6) http://doc.perl6.org/type/List#keys Returns a list of indexes into the list (i.e., 0..(@list.elems-1)). multi sub keys($list) returns List:D\nmulti method keys(List:D:) returns List:D
EnumMap.keys (Perl 6) http://doc.perl6.org/type/EnumMap#keys Returns a list of all keys in the EnumMap. method keys(EnumMap:D:) returns List:D
Date.truncated-to (Perl 6) http://doc.perl6.org/type/Date#truncated-to Returns a Date truncated to the first day of its year, month or week. For example method truncated-to(Date:D: :$year, :$month, :$week)
List.pop (Perl 6) http://doc.perl6.org/type/List#pop Removes and returns the last item from the list, fails for an empty list. multi sub pop(List:D )\nmulti method pop(List:D:)
Complex.im (Perl 6) http://doc.perl6.org/type/Complex#im Returns the imaginary part of the complex number. method im(Complex:D:) returns Real:D
Bool.prefix:<?> (Perl 6) http://doc.perl6.org/type/Bool#prefix%3A%3C%3F%3E Coerces its argument to Bool. multi sub prefix:<?>(Mu) returns Bool:D
List.unshift (Perl 6) http://doc.perl6.org/type/List#unshift Adds the @values to the start of the list, and returns the modified list. Fails if @values is infinite. multi sub unshift(List:D, *@values) returns List:D\nmulti method unshift(List:D: *@values) returns List:D
Str.tcuc (Perl 6) http://doc.perl6.org/type/Str#tcuc Turns the first character to title case, and all other characters to upper case multi sub tcuc(Str:D ) returns Str:D\nmulti method tcuc(Str:D:) returns Str:D
Str.comb (Perl 6) http://doc.perl6.org/type/Str#comb Searches for $matcher in $input and returns a list of all matches (as Str by default, or as Match if $match is True), limited to at most $limit matches. multi sub comb(Str:D $matcher, Str:D $input, $limit = Inf, Bool :$match) \nmulti sub comb(Regex:D $matcher, Str:D $input, $limit = Inf, Bool :$match) \nmulti method comb(Str:D $input:)\nmulti method comb(Str:D $input: Str:D $matcher, $limit = Inf, Bool :$match) \nmulti method comb(Str:D $input: Regex:D $matcher, $limit = Inf, Bool :$match)
Exception.message (Perl 6) http://doc.perl6.org/type/Exception#message This is a stub that must be overwritten by subclasses, and should return the exception message. method message(Exception:D:) returns Str:D
Backtrace::Frame.line (Perl 6) http://doc.perl6.org/type/Backtrace%3A%3AFrame#line Returns the line number (line numbers start to count from 1). method line(Backtrace::Frame:D) returns Int
Real.floor (Perl 6) http://doc.perl6.org/type/Real#floor Return the largest integer not greater than the number. method floor(Real:D) returns Int:D
Backtrace::Frame.is-routine (Perl 6) http://doc.perl6.org/type/Backtrace%3A%3AFrame#is-routine Return True if the frame point into a routine (and not into a mere Block). method is-routine(Backtrace::Frame:D) return Bool:D
Numeric.Rat (Perl 6) http://doc.perl6.org/type/Numeric#Rat If this Numeric is equivalent to a Real, return a Rat which is within $epsilon of that Real's value. Fail with X::Numeric::Real otherwise. method Rat(Numeric:D: Real $epsilon = 1.0e-6) returns Rat:D
Real.Rat (Perl 6) http://doc.perl6.org/type/Real#Rat Converts the number to a Rat with the precision $epsilon. method Rat(Real:D: Real $epsilon = 1e-6)
Parameter.named (Perl 6) http://doc.perl6.org/type/Parameter#named Returns True if it's a named parameter
List.rotate (Perl 6) http://doc.perl6.org/type/List#rotate Returns the list rotated by $n elements. multi sub rotate(@list, Int:D $n = 1) returns List:D\nmulti method rotate(List:D: Int:D $n = 1) returns List:D
Date.day (Perl 6) http://doc.perl6.org/type/Date#day Returns the day of the month of the date (1..31) method day(Date:D:) returns Int:D
Parameter.name (Perl 6) http://doc.perl6.org/type/Parameter#name Returns the variable name
X::AdHoc.payload (Perl 6) http://doc.perl6.org/type/X%3A%3AAdHoc#payload Returns the original object which was passed to die. method payload(X::AdHoc:D)
Parameter.optional (Perl 6) http://doc.perl6.org/type/Parameter#optional Returns True for optional parameters
Backtrace::Frame.is-hidden (Perl 6) http://doc.perl6.org/type/Backtrace%3A%3AFrame#is-hidden Returns True if the frame is marked as hidden with the is hidden_from_backtrace trait. method is-hidden(Backtrace::Frame:D) return Bool:D
Str.words (Perl 6) http://doc.perl6.org/type/Str#words Returns a list of non-whitespace bits, i.e. the same as a call to $input.comb( / \S+ /, $limit ) would. multi sub words(Str:D $input, $limit = Inf) returns Positional\nmulti method words(Str:D $input: $limit = Inf) returns Positional
Match.from (Perl 6) http://doc.perl6.org/type/Match#from Returns the index of the starting position of the match.
Str.succ (Perl 6) http://doc.perl6.org/type/Str#succ Returns the string incremented by one. method succ(Str:D) returns Str:D
Numeric.succ (Perl 6) http://doc.perl6.org/type/Numeric#succ Returns the number incremented by one (successor). method succ(Numerid:D:)
Date.succ (Perl 6) http://doc.perl6.org/type/Date#succ Returns the following day method succ(Date:D:) returns Date:D
Mu.clone (Perl 6) http://doc.perl6.org/type/Mu#clone Creates a shallow clone of the invocant. If named arguments are passed to it, their values are used in every place where an attribute name matches the name of a named argument. method clone(*%twiddles)
Match.caps (Perl 6) http://doc.perl6.org/type/Match#caps Returns a list of pairs, with the index or submatch name as key and the submatches as values. The list is ordered by starting position of the submatches.
List.splice (Perl 6) http://doc.perl6.org/type/List#splice Deletes $elems elements starting from index $start from the list, returns them and replaces them by @replacement. If $elems is omitted, all the elements starting from index $start are deleted. multi sub splice(@list, $start, $elems? *@replacement) returns List:D\nmulti method splice(List:D: $start, $elems? *@replacement) returns List:D
IO.changed (Perl 6) http://doc.perl6.org/type/IO#changed Timestamp when the inode was last changed. "path/to/file".IO.changed()
Date.today (Perl 6) http://doc.perl6.org/type/Date#today Returns a Date object for the current day. method today() returns Date:D
Str.flip (Perl 6) http://doc.perl6.org/type/Str#flip Returns the string reversed character by character. multi sub flip(Str:D ) returns Str:D\nmulti method flip(Str:D:) returns Str:D
Range.flat (Perl 6) http://doc.perl6.org/type/Range#flat Generates the list of elements that the range represents. method flat(Range:D:) returns List:D
Str.rindex (Perl 6) http://doc.perl6.org/type/Str#rindex Returns the last position of $needle in $haystack not after $startpos. Returns an undefined value if $needle wasn't found. multi sub rindex(Str:D $haystack, Str:D $needle, Int $startpos = $haystack.chars) returns StrPos\nmulti method rindex(Str:D $haystack: Str:D $needle, Int $startpos = $haystack.chars) returns StrPos
Code.signature (Perl 6) http://doc.perl6.org/type/Code#signature Returns the Signature object for this code object, which describes its parameters. multi method signature(Code:D:) returns Signature:D
Rational.nude (Perl 6) http://doc.perl6.org/type/Rational#nude Returns a list of the numerator and denominator. method nude(Rational:D:) returns Positional
Str.lcfirst (Perl 6) http://doc.perl6.org/type/Str#lcfirst Perl 6 does not have a lcfirst function.
Parameter.constraints (Perl 6) http://doc.perl6.org/type/Parameter#constraints Returns additional constraints on the parameter (usually as an all-Junction).
Match.orig (Perl 6) http://doc.perl6.org/type/Match#orig Returns the original string that the regex was matched against.
List.first (Perl 6) http://doc.perl6.org/type/List#first Returns the first item of the list which smart-matches against $matcher. multi sub first(Mu $matcher, *@elems)\nmulti method first(List:D: Mu $matcher)
Buf.decode (Perl 6) http://doc.perl6.org/type/Buf#decode Applies an encoding to turn the buffer into a Str. multi method decode(Buf:D: Str:D $encoding = 'UTF-8') returns Str:D
Match.chunks (Perl 6) http://doc.perl6.org/type/Match#chunks Returns a list of pairs, with the index or submatch name as key and the submatches as values. The list is ordered by starting position of the submatches.
Signature.params (Perl 6) http://doc.perl6.org/type/Signature#params Returns the list of Parameter objects that make up the signature. method params(Signature:D:) returns Positional
Parameter.parcel (Perl 6) http://doc.perl6.org/type/Parameter#parcel Returns True for parcel parameters sub f(\$parcel, $non-parcel) { }
Numeric.log (Perl 6) http://doc.perl6.org/type/Numeric#log Calculates the logarithm to base $base. Defaults to the natural logarithm. multi sub log(Numeric:D, Numeric $base = e) returns Numeric:D\nmulti method log(Numeric:D: Numeric $base = e) returns Numeric:D
Int.div (Perl 6) http://doc.perl6.org/type/Int#div Does an integer division, rounded down. multi sub infix:<div>(Int:D, Int:D) returns Int:D
Str.lines (Perl 6) http://doc.perl6.org/type/Str#lines Returns a list of lines (without trailing newline characters), i.e. the same as a call to $input.comb( / ^^ \N* /, $limit ) would. multi sub lines(Str:D $input, $limit = Inf) returns Positional\nmulti method lines(Str:D $input: $limit = Inf) returns Positional
Mu.new (Perl 6) http://doc.perl6.org/type/Mu#new Default method for constructing (create + initialize) new objects of a class. This method expects only named arguments which are then used to initialize attributes with accessors of the same name. multi method new(*%attrinit)
Complex.new (Perl 6) http://doc.perl6.org/type/Complex#new Creates a new Complex object from real and imaginary parts. proto method new(*@, *%) {*} returns Complex:D\nmulti method new(Real $re, Real $im) returns Complex:D
Rational.new (Perl 6) http://doc.perl6.org/type/Rational#new Creates a new rational object from numerator and denominator. method new(NuT:D $numerator, DenomT:D $denominator) returns Rational:D
Date.new (Perl 6) http://doc.perl6.org/type/Date#new Creates a new Date object, either from a tripple of (year, month, day) integers, or from a string of the form YYYY-MM-DD (ISO 8601), or from a DateTime object. proto method new() {*}\nmulti method new($year, $month, $day) returns Date:D\nmulti method new(:$year, :$month, :$day) returns Date:D\nmulti method new(Str $date) returns Date:D\nmulti method new(DateTime:D $dt) returns Date:D
Buf.new (Perl 6) http://doc.perl6.org/type/Buf#new Creates a Buf from a list of integers. method new(*@codes)
EnumMap.new (Perl 6) http://doc.perl6.org/type/EnumMap#new
Backtrace.new (Perl 6) http://doc.perl6.org/type/Backtrace#new Creates a new backtrace, using its calling location as the origin of the backtrace. proto method new(*@, *%) {*}\nmulti method new()
Parameter.named_names (Perl 6) http://doc.perl6.org/type/Parameter#named_names Returns a list of names/aliases for this parameter
List.grep (Perl 6) http://doc.perl6.org/type/List#grep Returns a lazy list of elements against which $matcher smart-matches. The elements are returned in the order in which they appear in the original list. multi sub grep(Mu $matcher, *@elems) returns List:D\nmulti method grep(List:D: Mu $matcher) returns List:D
List.join (Perl 6) http://doc.perl6.org/type/List#join Treats the elements of the list as strings, interleaves them with $separator and concatenates everything into a single string. multi sub join($separator, *@list) returns Str:D\nmulti method join(List:D: $separator) returns Str:D
List.reduce (Perl 6) http://doc.perl6.org/type/List#reduce Applies &with to the first and the second value of the list, then to result of that calculation and the third value and so on. Returns a single item generated that way. multi sub reduce(&with, *@elems)\nmulti method reduce(List:D: &with)
Enum.key (Perl 6) http://doc.perl6.org/type/Enum#key Returns the key part of the Enum. multi method key(Enum:D:)
Range.excludes_min (Perl 6) http://doc.perl6.org/type/Range#excludes_min Returns True if the start point is excluded from the range, and False otherwise. method excludes_min(Range:D:) returns Bool:D
List.classify (Perl 6) http://doc.perl6.org/type/List#classify classify transforms a list or array of values into a hash representing the classification of those values according to a mapper; each hash key represents the classification for one or more of the incoming list values, and the corresponding hash value contains an array of those list values classified by the mapper into the category of the associated key. For example: multi sub classify(&mapper, *@values) returns Hash:D\nmulti method classify(List:D: &mapper) returns Hash:D
Numeric.roots (Perl 6) http://doc.perl6.org/type/Numeric#roots Returns a list of the $n complex roots, which evaluate to the original number when raised to the $nth power. multi method roots(Numeric:D: Int:D $n) returns Positional
Parameter.capture (Perl 6) http://doc.perl6.org/type/Parameter#capture Returns True for parameters that capture the rest of the argument list sub f(\capture) { }
Date.month (Perl 6) http://doc.perl6.org/type/Date#month Returns the month of the date (1..12) method month(Date:D:) returns Int:D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment