Next: , Previous: , Up: Built-Ins   [Contents][Index]

### 4.5 Other Functions

` now()`

Returns the current time.
` now: () -> num`

` exec_time()`

Returns the lapsed time in seconds since this qulog process was started
` 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)`.
` random_num: () -> num`

` random_int(Lower, Upper)`

Returns a random number in the interval `[Lower, Upper]`.
` random_int: (int, int) -> num`

` S1 union S2`

Returns the union of sets `S1` and `S2`.
` union: ({T}, {T}) -> {T}`

` S1 inter S2`

Returns the intersection of sets `S1` and `S2`.
` inter: ({T}, {T}) -> {T}`

` S1 diff S2`

Returns the set difference of sets `S1` and `S2`.
` diff: ({T}, {T}) -> {T}`

` L1 <> L2`

Returns the concatination of lists `L1` and `L2`.
` <> : ([T], [T]) -> [T]`

` S1 ++ S2`

Returns the concatination of strings `S1` and `S2`.
` ++ : (string, string) -> string`

`#L`

Returns the length of the list, set, or string `L`.
`# : [T] -> nat | {T} -> nat | string -> nat`

`F@..Args`

Returns the compound term obtained by applying `F` to `Args`.
`@.. : (term, [term]) -> term`

Example:

```| ?? @..(a, [1,2]).

a(1, 2) : term
```

`@..` can also be used to split up a compound term as in the following example.

```| ?? a(1,2) =? F@..Args.

F = a : atom
Args = [1, 2] : [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 :=).

Next: , Previous: , Up: Built-Ins   [Contents][Index]