Application
classin packageklyn
public class Application:
Application

Global runtime entry point exposed by default in every Klyn program.

Static members can be used with or without the Application. prefix.

Application.print( "ok" )
print( "ok" )
Fields
Modifier and Type Member Description
public const EXIT_FAILURE
EXIT_FAILURE as Int = -1
Conventional failure exit code (`-1`).
public const EXIT_SUCCESS
EXIT_SUCCESS as Int = 0
Conventional success exit code (`0`).
Properties
Modifier and Type Member Description
public static native readonly property arguments
arguments as List<String>
Command-line arguments passed to the program.
public static readonly property classLoader
classLoader as SystemClassLoader:
Returns the runtime system class loader.
public static native readonly property environmentVariables
environmentVariables as Map<String, String>
Environment variables of the current process.
public static native readonly property err
err as TextWriter
Standard error stream of the process.
public static native readonly property in Standard input stream of the process.
public static native readonly property out
out as TextWriter
Standard output stream of the process.
public static native readonly property pid
pid as UInt
Process identifier of the current runtime.
public static native readonly property properties
properties as Map<String, String>
System properties exposed by the runtime.
Methods
Modifier and Type Member Description
public static native compile
compile(code as String) throws SyntaxError, TypeError, Exception
Compiles a Klyn script provided as a string.
public static native currentTimeMillis
currentTimeMillis() as ULong
Returns the current time in milliseconds since the Unix epoch.
public static native eval
eval(code as String) as Object throws SyntaxError, TypeError, Exception
Compiles and executes a Klyn script provided as a string.
public static native exit
exit(exitCode as Int)
Terminates the current process.
public static native input
input(prompt as String, inputStream as TextReader) as String
Reads a line from the given input stream, after optionally printing a prompt.
public static native print
print(values... as Object, sep as String, end as String, output as TextWriter)
Prints one or more values to the given output stream.
public static range
range<T>(start as T, stop as T) as Generator<T>:
Builds a Python-style integer range from `start` to `stop` (exclusive).
public static range
range<T>(start as T, stop as T, delta as T) as Generator<T>:
Builds a Python-style integer range from `start` to `stop` (exclusive) using the provided step.
public static range
range<T>(stop as T) as Generator<T>:
Builds a Python-style integer range from `0` to `stop` (exclusive).
public static sum
sum<T>(values as IList<T>) as T:
Returns the sum of all numeric values from a read-only list.
public static sum
sum<T>(values as Set<T>) as T:
Returns the sum of all numeric values from a set.
public static sum
sum<T>(values as klyn.math.NDArray<T>) as T:
Returns the sum of all numeric values from an NDArray.
public static sum
sum<T>(values... as T) as T:
Returns the sum of all numeric parameters.
public static native type
type(value as Object) as Type
Returns the runtime type of a value.