7.5 Other Functions

now()

Returns the current time.
fun now() -> num

exec_time()

Returns the lapsed time in seconds since this qulog process was started
fun exec_time() -> num

start_time()

Returns the time at which this qulog process was started
start_time: () -> num

random_num()

Returns a random number in [0,1).
fun random_num() -> num

random_int(Lower, Upper)

Returns a random integer in the interval [Lower, Upper].
fun random_int(int, int) -> num

S1 union S2

Returns the union of sets S1 and S2.
fun union(set(T), set(T)) -> set(T)

S1 inter S2

Returns the intersection of sets S1 and S2.
fun inter(set(T), set(T)) -> set(T)

S1 diff S2

Returns the set difference of sets S1 and S2.
fun diff(set(T), set(T)) -> set(T)

L1 <> L2

Returns the concatination of lists L1 and L2.
fun list(T) <> list(T) -> list(T)

S1 ++ S2

Returns the concatination of strings S1 and S2.
fun string ++ string -> string

#L

Returns the length of the list, set, or string L.
fun #list(T) -> nat, #set(T) -> nat, #string -> nat

$Name

Here Name is an atom that must have been initialised with a statement
int Name:=Integer, e.g. int count:=0 or
num Name:=Number, e.g. num savings:=678.50

in the program. It returns the current value associated with Name

which can be updated by primitive actions (see :=).


On This Site