routine gist
Documentation for routine gist
assembled from the following types:
class Junction§
From Junction
(Junction) method gist§
Defined as:
multi method gist(Junction:)
Collapses the Junction and returns a Str composed of the type of the junction and the gists of its components:
<a 42 c>.all.say; # OUTPUT: «all(a, 42, c)»
class Submethod§
From Submethod
(Submethod) method gist§
Defined as:
multi method gist(Submethod:)
Returns the name of the submethod.
class Mu§
From Mu
(Mu) routine gist§
multi sub gist(+args --> Str)multi method gist( --> Str)
Returns a string representation of the invocant, optimized for fast recognition by humans. As such lists will be truncated at 100 elements. Use .perl
to get all elements.
The default gist
method in Mu
re-dispatches to the perl method for defined invocants, and returns the type name in parenthesis for type object invocants. Many built-in classes override the case of instances to something more specific that may truncate output.
gist
is the method that say calls implicitly, so say $something
and say $something.gist
generally produce the same output.
say Mu.gist; # OUTPUT: «(Mu)»say Mu.new.gist; # OUTPUT: «Mu.new»
class Backtrace§
From Backtrace
(Backtrace) method gist§
Defined as:
multi method gist(Backtrace:)
Returns string "Backtrace(42 frames)"
where the number indicates the number of frames available via list method.
class Nil§
From Nil
(Nil) method gist§
method gist(--> Str)
Returns "Nil"
.
class Attribute§
From Attribute
(Attribute) method gist§
Defined as
multi method gist(Attribute:)
Returns the name of the type followed by the name of the attribute.
say Hero.^attributes(:local)[0]; # OUTPUT: «Positional @!inventory»
Since say implicitly calls .gist
, that is what produces the output here.
class Array§
From Array
(Array) method gist§
Exactly the same as List.gist
, except using square brackets for surrounding delimiters.
class Complex§
From Complex
(Complex) method gist§
Defined as:
method gist(Complex: --> Str)
Returns a string representation of the form "1+2i", without internal spaces. (Str coercion also returns this.)
say (1-4i).gist; # OUTPUT: «1-4i»
class ForeignCode§
From ForeignCode
(ForeignCode) method gist§
method gist( ForeignCode: )
Returns the name of the code by calling name
.
class Version§
From Version
(Version) method gist§
method gist(Version: --> Str)
Returns a string representation of the invocant, just like Str, prepended with a lower-case v
.
my = v1.0.1;my = Version.new('1.0.1');say .gist; # OUTPUT: «v1.0.1»say .gist; # OUTPUT: «v1.0.1»
class Date§
From Date
(Date) method gist§
Defined as:
multi method gist(Date: --> Str)
Returns the date in YYYY-MM-DD
format (ISO 8601)
say Date.new('2015-12-24').gist; # OUTPUT: «2015-12-24»
role Systemic§
From Systemic
(Systemic) method gist§
method gist( Systemic: )
Instance method returning the name and version of the object.
say .gist; # OUTPUT: «Perl 6 (6.c)»
$*PERL
is an object of the Perl type, which mixes in this role and thus implements this method.
class Map§
From Map
(Map) method gist§
Defined as:
method gist(Map: --> Str)
Returns the string containing the "gist" of the Map, sorts the pairs and lists up to the first 100, appending an ellipsis if the Map has more than 100 pairs.
class Exception§
From Exception
(Exception) method gist§
Defined as:
multi method gist(Exception:)
Returns whatever the exception printer should produce for this exception. The default implementation returns message and backtrace separated by a newline.
my = X::AdHoc.new(payload => "This exception is pretty bad");try .throw;if ($!) ;# OUTPUT: «This exception is pretty bad# in block <unit> at <unknown file> line 1»
class List§
From List
(List) method gist§
Defined as:
multi method gist(List: --> Str)
Returns the string containing the parenthesized "gist" of the List, listing up to the first 100 elements, separated by space, appending an ellipsis if the List has more than 100 elements. If List is-lazy
, returns string '(...)'
put (1, 2, 3).gist; # OUTPUT «(1 2 3)»put (1..∞).List.gist; # OUTPUT «(...)»put (1..200).List.gist;# OUTPUT:# (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26# 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49# 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72# 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95# 96 97 98 99 100 ...)
role Blob§
From Blob
(Blob) method gist§
Defined as:
method gist(Blob: --> Str)
Returns the string containing the "gist" of the Blob, listing up to the first 100 elements, separated by space, appending an ellipsis if the Blob has more than 100 elements.
put Blob.new(1, 2, 3).gist; # OUTPUT: «Blob:0x<01 02 03>»put Blob.new(1..2000).gist;# OUTPUT:# Blob:0x<01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15# 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C# 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40 41 42 43# 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A# 5B 5C 5D 5E 5F 60 61 62 63 64 ...>
class IO::Path§
From IO::Path
(IO::Path) method gist§
Defined as:
method gist(IO::Path: --> Str)
Returns a string, part of which contains either the value of .absolute
(if path is absolute) or .path
. Note that no escaping of special characters is made, so e.g. "\b"
means a path contains a backslash and letter "b", not a backspace.
say "foo/bar".IO; # OUTPUT: «"foo/bar".IO»say IO::Path::Win32.new: 「C:\foo/bar\」; # OUTPUT: «"C:\foo/bar\".IO»
class IO::Handle§
From IO::Handle
(IO::Handle) method gist§
Defined as:
method gist(IO::Handle: --> Str)
Returns a string containing information which .path
, if any, the handle is created for and whether it is .opened
.
say IO::Handle.new; # IO::Handle<(Any)>(closed)say "foo".IO.open; # IO::Handle<"foo".IO>(opened)