mirror of
https://github.com/PDP-10/its.git
synced 2026-01-16 08:24:38 +00:00
23 lines
707 B
Plaintext
23 lines
707 B
Plaintext
(cgol)$
|
|
|
|
% The following utility routines are of general interest. %
|
|
|
|
define lexpr cat(n); % concatenates arguments; e.g. (CAT 'AB 'XY) -> ABXY %
|
|
implode append{explodec[arg[1 to n]]} $
|
|
|
|
define mod(a,b); % (MOD A B) is in the range 0 to b-1 even when a < 0 %
|
|
let x := a rem b; if minusp a ne minusp b and not zerop x then x+b else x $
|
|
|
|
define to(aa, b, c); % (TO 5 19 3) = (5 8 11 14 17) %
|
|
aa <= b and new x; x := [aa] & while b>=aa:=aa+c do x := cdr(cdr x := [aa]) $
|
|
|
|
define circ(x); x & cdr last x := x $
|
|
|
|
special ?&stopwatch$ % used by following timing routine %
|
|
|
|
define timer(); % (TIMER) = CPU time in seconds since last invoked %
|
|
-?&stopwatch + ?&stopwatch := runtime()/1000000 $
|
|
|
|
=exit$
|
|
|