The Karajan kernel contains a minimum set of elements that are required in order to get the rest of the system running. All kernel elements are automatically available in any program.
Represents the true boolean value
Represents the false boolean value
Holds a list with the command line arguments (if any)
Contains the path to the user home directory
Contains the current user's name
The root element of a Karajan program. Accepts arguments on the
stdout channel and prints them immediately on the console.
Executes the file specified by the
file argument. All arguments received on the default channel are considered to be element definitions (created with export), which import binds to the parent environment, such that after import completes execution, the definitions will be available for use.
foo( import("file.k") ) //scope of foo() ends
Import uses the library search path specified in
etc/karajan.properties, which defaults to searching the current directory first, then the Java class path. If no file with the given name is found in the library search path, import will fail.
Returns the pair (
value argument should be a lambda, which can be bound by import.
It is also possible for
export to be used without arguments, but with a set of immediately enclosed definitions. In this case it would take all the definitions and export them. This makes it easier to have old code somewhat cleanly converted:
Binds a lambda, specified by the
value argument to the given
Allows the specification of a namespace prefix. Any elements defined in the scope of namespace will automatically have the prefix indicated by the
prefix argument, unless another namespace is nested.
Used by the current implementation to map element names to Java implementation classes.
Used internally by the named argument form, but can be used by the user equally well. The following are equivalent:
However, the fact that the
*name argument is optional makes it impossible to completely avoid the named form.
*name argument is not present, it simply returns the value of the
value argument on the default channel.
Can be used with the XML syntax to represent a number. There is no distinction between integral numbers and floating point numbers in Karajan.
Can be used with the XML syntax to represent a string value.
Used to represent the value of a variable.
setname="n" value="5"/> <
string>10</string> <variable>n</variable> </list>
will return the list [10, “10”, 5].
Used internally to represent a quoted list. The following two lines of code will produce the same result:
[a, b, c] quotedlist(a, b, c)
Caches the evaluation of the arguments. Upon subsequent executions of cache, the arguments will not be re-evaluated. Instead, the cached values will be returned. Cache does not make any checks for the invariance of the evaluation of the arguments.