The Ceylon language module containing the core types referred to in the language specification.
Packages | |
ceylon.language | The Ceylon language package. |
ceylon.language.metamodel |
The Ceylon language package.
Attributes | |
empty | Source Code shared empty empty A sequence with no elements, abbreviated |
emptyIterator | Source Code shared emptyIterator emptyIterator An iterator that returns no elements. |
equal | Source Code shared equal equal The value is exactly equal to the given value. By: Gavin |
false | Source Code shared false false A value representing falsity in Boolean logic. By: Gavin |
finished | Source Code shared finished finished A value that indicates that an See also: Iterator |
infinity | Source Code An instance of |
language | Source Code shared language language Contains information about the language By: The Ceylon Team |
larger | Source Code shared larger larger The value is larger than the given value. By: Gavin |
nothing | Source Code shared Nothing nothing A value that is assignable to any type, but that results in an exception when evaluated. This is most useful for generating members in an IDE. |
null | Source Code shared null null The null value. By: Gavin |
process | Source Code shared process process Represents the current process (instance of the virtual machine). By: Gavin, Tako |
smaller | Source Code shared smaller smaller The value is smaller than the given value. By: Gavin |
true | Source Code shared true true A value representing truth in Boolean logic. By: Gavin |
Methods | |
abstract | Source Code shared Null abstract() Annotation to mark a class as abstract. An |
actual | Source Code shared Null actual() Annotation to mark a member of a type as refining a member of a supertype. |
any | Source Code Determines if any one of the given boolean values
(usually a comprehension) is See also: every |
array | Source Code Create an array containing the given elements. If no elements are provided, create an empty array of the given element type. |
arrayOfSize | Source Code Create an array of the specified size, populating every
index with the given element. If the specified size is
smaller than Parameters:
|
by | Source Code Annotation to specify API authors. |
byDecreasing | Source Code A comparator which orders elements in decreasing order
according to the See also: byIncreasing |
byIncreasing | Source Code A comparator which orders elements in increasing order
according to the See also: byDecreasing |
byItem | Source Code shared Comparison byItem<Item>(Comparison comparing(Item x, Item y))(Entry<Object,Item> x, Entry<Object,Item> y) A comparator for See also: byKey |
byKey | Source Code shared Comparison byKey<Key>(Comparison comparing(Key x, Key y))(Entry<Key,Object> x, Entry<Key,Object> y) A comparator for See also: byItem |
className | Source Code Return the name of the concrete class of the given object. |
coalesce | Source Code Return a sequence containing the given values which are not null. If there are no values which are not null, return an empty sequence. Parameters:
|
combine | Source Code shared Iterable<Result,Absent> combine<Result, Absent, Element, OtherElement>(Result combination(Element element, OtherElement otherElement), Iterable<Element,Absent> elements, Iterable<OtherElement,Absent> otherElements) Applies a function to each element of two By: Gavin, Enrique Zamudio, Tako |
compose | Source Code |
count | Source Code A count of the number of |
curry | Source Code shared Callable<Return,Rest> curry<Return, Argument, First, Rest>(Callable<Return,Tuple<Argument,First,Rest>> f)(First first) given First satisfies Argument |
default | Source Code shared Null default() Annotation to mark a member whose implementation may be
refined by subtypes. Non- |
deprecated | Source Code Annotation to mark program elements which should not be used anymore. |
doc | Source Code Annotation to specify API documentation of a program element. |
emptyOrSingleton | Source Code |
entries | Source Code shared Iterable<Entry<Integer,Element&Object>,Null> entries<Element>(Iterable<Element,Null> elements) Produces a sequence of each index to element |
equalTo | Source Code Returns a partial function that will compare an element to any other element and returns true if they're equal. This is useful in conjunction with methods that receive a predicate function. |
every | Source Code Determines if every one of the given boolean values
(usually a comprehension) is See also: any |
final | Source Code shared Null final() Annotation to mark a class as final. A |
first | Source Code The first of the given elements (usually a comprehension), if any. |
flatten | Source Code |
forItem | Source Code A function that returns the result of the given See also: forKey |
forKey | Source Code A function that returns the result of the given See also: forItem |
formal | Source Code shared Null formal() Annotation to mark a member whose implementation must be provided by subtypes. |
greaterThan | Source Code Returns a partial function that will compare an element to any other element and returns true if the compared element is greater than its element. This is useful in conjunction with methods that receive a predicate function. |
identical | Source Code Determine if the arguments are identical. Equivalent to
Parameters:
See also: identityHash |
identityHash | Source Code Return the system-defined identity hash value of the given value. This hash value is consistent with identity equality. See also: identical |
join | Source Code Given a list of iterable objects, return a new sequence of all elements of the all given objects. If there are no arguments, or if none of the arguments contains any elements, return the empty sequence. Parameters:
See also: SequenceBuilder |
largest | Source Code Given two See also: Comparable, smallest, max |
late | Source Code shared Null late() Annotation to disable definite initialization analysis for a reference. |
lessThan | Source Code Returns a partial function that will compare an element to any other element and returns true if the compared element is less than its element. This is useful in conjunction with methods that receive a predicate function. |
license | Source Code Annotation to specify the URL of the license of a module or package. |
max | Source Code Given a nonempty sequence of See also: Comparable, min, largest |
min | Source Code Given a nonempty sequence of See also: Comparable, max, smallest |
native | Source Code shared Null native() Annotation to mark a member whose implementation is be provided by platform-native code. |
optional | Source Code shared Null optional() Annotation to specify that a module can be executed even if the annotated dependency is not available. |
parseFloat | Source Code The The syntax accepted by this method is the same as the
syntax for a |
parseInteger | Source Code The The syntax accepted by this method is the same as the
syntax for an |
plus | Source Code |
Source Code Print a line to the standard output of the virtual
machine process, printing the given value's This method is a shortcut for: process.writeLine(line?.string else "«null»") and is intended mainly for debugging purposes. By: Gavin See also: process.writeLine | |
product | Source Code Given a nonempty sequence of See also: sum |
see | Source Code Annotation to specify API references to other related program elements. |
shared | Source Code shared Null shared() Annotation to mark a type or member as shared. A |
shuffle | Source Code shared Callable<Callable<Result,FirstArgs>,SecondArgs> shuffle<Result, FirstArgs, SecondArgs>(Callable<Callable<Result,SecondArgs>,FirstArgs> f) |
smallest | Source Code Given two See also: Comparable, largest, min |
sort | Source Code Sort the given elements, returning a new sequence. See also: Comparable |
string | Source Code Create a new string containing the given characters. |
sum | Source Code Given a nonempty sequence of See also: product |
tagged | Source Code Annotation to categorize the API by tag. |
throws | Source Code Annotation to mark a program element that throws an exception. |
times | Source Code |
uncurry | Source Code shared Callable<Return,Tuple<Argument,First,Rest>> uncurry<Return, Argument, First, Rest>(Callable<Return,Rest> f(First first)) given First satisfies Argument |
unflatten | Source Code |
variable | Source Code shared Null variable() Annotation to mark an value as variable. A |
zip | Source Code shared Sequential<Entry<Key,Item>> zip<Key, Item>(Iterable<Key,Null> keys, Iterable<Item,Null> items) Given two sequences, form a new sequence consisting of all entries where, for any given index in the resulting sequence, the key of the entry is the element occurring at the same index in the first sequence, and the item is the element occurring at the same index in the second sequence. The length of the resulting sequence is the length of the shorter of the two given sequences. Thus: zip(xs,ys)[i]==xs[i]->ys[i] for every |
Interfaces | |
Binary | Source Code Abstraction of numeric types that consist in
a sequence of bits, like |
Callable | Source Code A reference to a function. The type arguments encode
the function return type and parameter types. The
parameter types are typically represented as a tuple
type. For example, the type of the function reference
Callable<Float,[Float,Float]> which we usually abbreviate Float(Float,Float) add = plus<Float>; value four = add(2.0, 2.0); or by supplying a tuple containing the arguments: Float(Float,Float) add = plus<Float>; [Float,Float] twoAndTwo = [2.0, 2.0]; value four = add(*twoAndTwo); This interface may not be implemented by user code. |
Category | Source Code shared Category Abstract supertype of objects that contain other
values, called elements, where it is possible to
efficiently determine if a given value is an element.
The if ("hello" in "hello world") { ... } if (69 in 0..100) { ... } if (key->value in { for (n in 0..100) n.string->n**2 }) { ... } Ordinarily, |
Cloneable | Source Code Abstract supertype of objects whose value can be cloned. |
Closeable | Source Code shared Closeable Abstract supertype of types which may appear
as the expression type of a resource expression
in a |
Collection | Source Code Represents an iterable collection of elements of finite
size. A All |
Comparable | Source Code The general contract for values whose magnitude can be
compared. The total order of a type must be consistent with the definition of equality for the type. That is, there are three mutually exclusive possibilities:
|
Container | Source Code Deprecated: Will be removed in Ceylon 1.0. Abstract supertype of objects which may or may not
contain one of more other values, called elements,
and provide an operation for accessing the first
element, if any. A container which may or may not be
empty is a |
Correspondence | Source Code Abstract supertype of objects which associate values
with keys. The item corresponding to a given key may be obtained
from a value bg = settings["backgroundColor"] else white; The |
Empty | Source Code shared Empty A sequence with no elements. The type [] none = []; (Whether the syntax |
EmptyContainer | Source Code shared EmptyContainer Deprecated: Will be removed in Ceylon 1.0. An empty container. |
Enumerable | Source Code Abstraction of ordinal types whose instances can be mapped to the integers or to a range of integers. |
Exponentiable | Source Code Abstraction of numeric types that may be raised to a power. Note that the type of the exponent may be different to the numeric type which can be exponentiated. |
Identifiable | Source Code shared Identifiable The abstract supertype of all types with a well-defined
notion of identity. Values of type |
Integral | Source Code Abstraction of integral numeric types. That is, types
with no fractional part, including |
Invertable | Source Code Abstraction of types which support a unary additive inversion operation. For a numeric type, this should return the negative of the argument value. Note that the type parameter of this interface is not restricted to be a self type, in order to accommodate the possibility of types whose additive inverse can only be expressed in terms of a wider type. |
Iterable | Source Code Abstract supertype of containers whose elements may be iterated. An iterable container need not be finite, but its elements must at least be countable. There may not be a well-defined iteration order, and so the order of iterated elements may not be stable. The type An instance of {String+} words = { "hello", "world" }; An instance of for (c in "hello world") { ... }
Lazy operations are preferred, because they can be efficiently chained. For example: string.filter((Character c) => c.letter) .map((Character c) => c.uppercased) is much less expensive than: string.select((Character c) => c.letter) .collect((Character c) => c.uppercased) Furthermore, it is always easy to produce a new immutable iterable object given the view produced by a lazy operation. For example: [ string.filter((Character c) => c.letter) .map((Character c) => c.uppercased)... ] Lazy operations normally return an instance of
However, there are certain scenarios where an eager operation is more useful, more convenient, or no more expensive than a lazy operation, including:
Eager operations normally return a sequence. |
Iterator | Source Code Produces elements of an |
List | Source Code Represents a collection in which every element has a unique non-negative integer index. A Direct access to a list element by index produces a
value of optional type. The following idiom may be
used instead of upfront bounds-checking, as long as
the list element type is a non- value char = "hello world"[index]; if (exists char) { /*do something*/ } else { /*out of bounds*/ } To iterate the indexes of a for (i->char in "hello world".indexed) { ... } |
Map | Source Code Represents a collection which maps keys to items,
where a key can map to at most one item. Each such
mapping may be represented by an A The prescence of an entry in a map may be tested
using the if ("lang"->"en_AU" in settings) { ... } The entries of the map may be iterated using for (key->item in settings) { ... } The item for a key may be obtained using the item operator: String lang = settings["lang"] else "en_US"; |
NonemptyContainer | Source Code Deprecated: Will be removed in Ceylon 1.0. A nonempty container. |
Number | Source Code shared Number Abstraction of numbers. Numeric operations are provided
by the subtype |
Numeric | Source Code Abstraction of numeric types supporting addition,
subtraction, multiplication, and division, including
|
Ordinal | Source Code Abstraction of ordinal types, that is, types with
successor and predecessor operations, including
|
Ranged | Source Code Abstract supertype of ranged objects which map a range
of A span may be obtained from an instance of print("hello world"[0..5]) |
Scalar | Source Code Abstraction of numeric types representing scalar
values, including |
Sequence | Source Code A nonempty, immutable sequence of values. The type
Given a possibly-empty sequence of type [Integer*] nums = ... ; if (nonempty nums) { Integer first = nums.first; Integer max = max(nums); [Integer+] squares = nums.collect((Integer i) i**2)); [Integer+] sorted = nums.sort(byIncreasing((Integer i) i)); } Operations like |
Sequential | Source Code A possibly-empty, immutable sequence of values. The
type
|
Set | Source Code A collection of unique elements. A Sets may be the subject of the binary union,
intersection, exclusive union, and complement operators
|
Summable | Source Code Abstraction of types which support a binary addition operator. For numeric types, this is just familiar numeric addition. For strings, it is string concatenation. In general, the addition operation should be a binary associative operation. |
Classes | |
Anything | Source Code shared abstract Anything The abstract supertype of all types. A value of type
Note that the type |
Array | Source Code A fixed-size array of elements. An array may have zero size (an empty array). Arrays are mutable. Any element of an array may be set to a new value. This class is provided primarily to support interoperation with Java, and for some performance-critical low-level programming tasks. |
ArraySequence | Source Code An immutable |
Basic | Source Code shared abstract Basic The default superclass when no superclass is explicitly
specified using |
Boolean | Source Code shared abstract Boolean A type capable of representing the values true and false of Boolean logic. |
Character | Source Code shared abstract Character A 32-bit Unicode character. |
Comparison | Source Code shared abstract Comparison The result of a comparison between two |
Entry | Source Code A pair containing a key and an associated value called
the item. Used primarily to represent the elements of
a String->Person entry = person.name->person; |
Finished | Source Code shared abstract Finished The type of the value that indicates that
an |
Float | Source Code shared abstract Float An IEEE 754 64-bit floating point number. A |
Integer | Source Code shared abstract Integer A 64-bit integer, or the closest approximation to a 64-bit integer provided by the underlying platform.
Overflow or loss of precision occurs silently (with no exception raised). |
LazyList | Source Code An implementation of List that wraps an |
LazyMap | Source Code A Map implementation that wraps an |
LazySet | Source Code An implementation of Set that wraps an |
Null | Source Code shared abstract Null The type of the The String? firstArg = process.arguments.first; if (exists firstArg) { print("hello " + firstArg); } The String name = process.arguments.first else "world"; The Float? diff = x>=y then x-y; |
Object | Source Code shared abstract Object The abstract supertype of all types representing
definite values. Any two true==false 1=="hello world" "hello"+ " " + "world"=="hello world" Singleton("hello world")=={ "hello world" } However, since |
Range | Source Code Represents the range of totally ordered, ordinal values
generated by two endpoints of type A range may be produced using the for (i in min..max) { ... } if (char in `A`..`Z`) { ... } |
SequenceAppender | Source Code This class is used for constructing a new nonempty
sequence by incrementally appending elements to an
existing nonempty sequence. The existing sequence is
not modified, since |
SequenceBuilder | Source Code Since sequences are immutable, this class is used for constructing a new sequence by incrementally appending elements to the empty sequence. This class is mutable but threadsafe. |
Singleton | Source Code A sequence with exactly one element, which may be null. |
String | Source Code shared abstract String A string of characters. Each character in the string is a 32-bit Unicode character. The internal UTF-16 encoding is hidden from clients. A string is a 'w' in greeting "hello" in greeting Strings are summable: String greeting = "hello" + " " + "world"; They are efficiently iterable: for (char in "hello world") { ... } They are value char = "hello world"[5]; They are ranged: String who = "hello world"[6...]; Note that since The string(for (s in "hello world") if (s.letter) s.uppercased) Since a |
StringBuilder | Source Code shared StringBuilder Since strings are immutable, this class is used for constructing a string by incrementally appending characters to the empty string. This class is mutable but threadsafe. |
Tuple | Source Code A tuple is a typed linked list. Each instance of
value point = Tuple(0.0, Tuple(0.0, Tuple("origin"))); Float x = point.first; Float y = point.rest.first; String label = point.rest.rest.first; Usually, we abbreviate code involving tuples. [Float,Float,String] point = [0.0, 0.0, "origin"]; Float x = point[0]; Float y = point[1]; String label = point[2]; A list of types enclosed in brackets is an abbreviated
tuple type. An instance of [String,String] words = ["hello", "world"]; The index operator with a literal integer argument is a
shortcut for a chain of evaluations of A terminated tuple type is a tuple where the type of
the last link in the chain is Here, String[] labels = ... ; [Float,Float,String*] point = [0.0, 0.0, *labels]; Float x = point[0]; Float y = point[1]; String? firstLabel = point[2]; String[] allLabels = point[2...]; |
empty | Source Code shared empty A sequence with no elements, abbreviated |
emptyIterator | Source Code shared emptyIterator An iterator that returns no elements. |
equal | Source Code shared equal The value is exactly equal to the given value. |
false | Source Code shared false A value representing falsity in Boolean logic. |
finished | Source Code shared finished A value that indicates that an |
language | Source Code shared language Contains information about the language |
larger | Source Code shared larger The value is larger than the given value. |
null | Source Code shared null The null value. |
process | Source Code shared process Represents the current process (instance of the virtual machine). |
smaller | Source Code shared smaller The value is smaller than the given value. |
true | Source Code shared true A value representing truth in Boolean logic. |
Exceptions | |
AssertionException | Source Code shared AssertionException An exception that occurs when an assertion fails, that
is, when a condition in an |
Exception | Source Code shared Exception The supertype of all exceptions. A subclass represents a more specific kind of problem, and may define additional attributes which propagate information about problems of that kind. |
InitializationException | Source Code shared InitializationException Thrown when a problem was detected with value initialization. Possible problems include:
|
NegativeNumberException | Source Code shared NegativeNumberException Thrown when a negative number is not allowed. |
OverflowException | Source Code shared OverflowException Thrown when a mathematical operation caused a number to overflow from its bounds. |