An OADL intrinsic procedure is one which is built-in to the OADL
machine. It is not possible to place the address of an intrinsic
procedure in a variable. Additionally, the number of arguments to
intrinsic procedures is generally checked at compile-time. All OADL
intrinsic procedures except for typeof are found
in the oadl namespace.
These intrinsics deal with procedure arguments:
arg(n)
nargs() argvec()
List containing all of the
arguments to the current procedure.These intrinsics modify the execution of the OADL machine:
halt() setjmp(buf)
longjmp()
non-local jumplongjmp(buf,
val) setjmp() was calledsave(filename)
restore(filename)
restart()
These intrinsics manage various aspects of the dynamic memory subsystem:
gc() protect(val)
readonly(val)
readonly(obj,
pub) deleted(obj)
true if the given obj has
been marked for deletionperm(val)
transient(val)
These intrinsics return information about the types of their arguments:
typeof(val)
Int, Null,
Float, etc. Unlike all other intrinsic
procedures, typeof() is found in the global
namespace.typecheck(typ,
val) TypeCheck exception is
thrown. Returns true if the type matches.is_a(obj,cls)
true if the class cls is a
parent of the given object obj, and
false otherwise. Same as the
?= comparison operator.These procedures are all found in the global namespace. See the chapter on Input / Output for more information about them.
getchar()
getchar(file)
print(fmtstring,
arg, ...) print(file,
fmtstring, arg, ...) putchar(ch)
putchar(file,
ch) ungetc(ch)
ungetc(file,
ch) read(fmtstring,
typ, ...) read(file,
fmtstring, typ, ...) read(string,
fmtstring, typ, ...) readstr()
readstr(file)
say(arg,
arg, ...) say(file,
arg, arg, ...) These procedures are found in namespace io.
io::putvar(arg,
arg, ...) io::putvar(file,
arg, arg, ...) io::getvar()
io::getvar(file)
io::Input) which must be formatted as
io::putvar() does.There are a couple of other miscellaneous intrinsic procedures supported by OADL:
matchvec()
List of all of the match
pattern substrings ?1, ?2,
etc.format(fmtstring,
arg, ...) Several methods are predefined for all OADL classes. They may be overridden by the OADL programmer. See the chapter on Classes for a detailed description of these methods:
.create()
Object is created.destroy()
.operator
{}(args) Intrinsic methods are provided by OADL to perform a broad range of
operations. Note that, unlike programmer-defined methods, OADL
intrinsic methods can operate on values with types other than
Object.
.arrbase()
Char, Int, etc.) or
Array if arr is a heterogeneous
List or Array..isarray()
true if val is an array of
any kind (List, String,
PackInt, etc.) and false
otherwise..ischar()
true if val is a scalar
character of any kind (Char or
WideChar) and false
otherwise..isfloat()
true if val is a floating
point scalar of any kind (Half,
Float, or Double) and
false otherwise..isinteger()
true if val is an integral
scalar of any kind (Byte,
Ubyte, Short,
Ushort, Int,
Uint, Long, or
Ulong) and false otherwise..isnumeric()
true if val is a numeric
scalar of any kind (Byte,
Ubyte, Short,
Ushort, Int,
Uint, Long,
Ulong, Half,
Float, or Double) and
false otherwise..isstring()
true if val is string of
any kind (String or
WideString) and false
otherwise..length()
public
properties of an object, or the number of currently defined
key/value pairs in a dictionary..maxval()
Float, Int, etc.).minval()
Float, Int, etc.).packtype()
Int.packtype()
returns PackInt).promote(val1)
Type they are used directly. If they are
not an OADL TYpe, their base types are used as
the indexes into the table..rank()
rank of a
scalar is 0..shape()
PackInt array which is the
multi-dimensional shape of val. The
shape of a scalar is the empty packed integer
array 0->iterate().sizeof()
sizeof a scalar is 1..copy()
@ operator. The new copy is
neither permanent nor read-only regardless of whether val is
permanent or read-only..deepcopy()
@@ operator. The new copy is
neither permanent nor read-only regardless of whether val is
permanent or read-only..readonly()
.readonly(pub)
public property pub of
Object obj is read-only. A
TypeCheck exception is thrown if val,
obj, or pub is not of an appropriate type..transient()
true if the given val is
located in dynamically maintained memory subject to garbage
collection, and false otherwise. A
TypeCheck exception is thrown if val is
not of an appropriate type.See the chapter on Input / Output for more information about these intrinsic methods.
.binary()
.clearerr()
.close()
.close(disp)
.feof()
.ferror()
.fflush()
.fseek(offs,
whence) .ftell()
.getchar()
.getswab()
.getvar()
getvar().ispipe()
.print(fmtstr,
arg, ...) .putchar()
.putvar(arg,
...) .read(typ,
typ, ...) .read(fmtstr,
typ, typ, ...) .read(fmtstr,
typ, typ, ...) .readonly()
.readstr()
.rewind()
.say(arg,
arg, ...) .setswab(bSwab)
.ungetc()
.write(val,
val, ...) .abs() .clamp(lower,
upper) .fix2flt(typ)
.flt2fix(typ)
fix2flt(). Convert a value
or array of values from floating point to a specified 8- or 16-bit
signed or unsigned fixed-point number..lerp(last,
dist) .max(val1,
val2, ...) .min(val1,
val2, ...) .satadd(val1,
lower, upper) .satsub(val1,
lower, upper) .signum()
Many of these methods were inspired by the programming language APL, which is an innovative interactive language developed in the 1960s to perform many array calculations and general-purpose computing tasks. There are a few conventions that should be noted:
List, String,
PackInt, etc.).operator
op syntax (for arithmetic operators), the
` op syntax (for operators or public
indexes), or with the public::pub syntax
(for public indexes). Procedures can be passed without special
syntax..rank() +
axis, so axis number -1 is the last axis, axis
number -2 is the next-to-last axis, and so on. Typically, if no
axis is specified, the last axis of an array is used.Unlike APL, English names of the various array operations are used for the array intrinsic methods.
.accum(op)
.accum(op,
axis) .arrcmp(arr1)
.concat(b,
c, ...) ## operator..decode(val1)
.disclose()
.drop(num)
.drop(num,
axis) .enclose()
.enclose(axis)
.encode(val)
.flatten()
.increment(shp)
.inner(op0,
op1, arr1) .intersect(arr1)
.iterate()
.laminate(arr1)
.laminate(arr1,
axis) .member(arr)
.nreduce(n,
op) .nreduce(n,
op, axis) .outer(op,
arr1) .pack()
.position(items)
.ravel()
.ravel(axis)
.reduce(op)
.reduce(op,
axis) .replicate(key)
.replicate(key,
axis) .reshape(d0,
d1, ...) .reshape(shp)
.reverse()
.reverse(axis)
.rotate(num)
.rotate(num,
axis) setsubr(beg0,
end0, beg1, end1, ..., val
) [beg0:end0,
beg1:end1,
...] = val.sort()
.sort(cmp)
operator < is assumed..stride()
subr(beg0,
end0, beg1, end1, ...
) [beg0:end0,
beg1:end1,
...]..take(num)
.take(num,
axis) .transpose()
.transpose(permutation)
.union(arr2)
.unique()
.unpack()
List (for single-dimensional arrays)
or an Array (for multi-dimensional arrays)..width()
.without(arr2)