Procedure Parameters passed by value BUT a struct "value" is a ptr to struct ! !f produce string, next line of file f, fail on eof ! !x generate elements of string, list, table or recd " "a string" a string of course # comment to eoln % n%m mod, remainder of n divided by m & x&y produce y (if x succeeds) &ascii char set, ascii chars &clock string, time of day &cset char set, 256 chars &date string, date &errout file, stderror file &input file, std input &lcase character set, lower case chars &level int, level of current proc call &main main program coexpression &null produces null value &pos int, position of scan in &subject &random variable, seed for pseudo random no's (see `?') &source coexp, activator of current coexp &subject variable, current subject string &time time in millisecs since program started &trace variable, value control tracing &ucase character set, upper case chars &version string, version of icon ' 'chset' character set * *s size of list string, table recd also no of results of coexp * x*y multiplication ** c1**c2 char set intersection *:= x*:=e x:=x*(e) + +n returns numeric value of n, n int or real + x+y addition ++ s++t char set union +:= x+:=e x:=x+(e) - -n produce 0-n - x-y subtraction -- s--t char set difference -:= x-:=e x:=x-(e) . .x produce value of x, dereferencing . r.f record field selection / /x succeeds if x has null (absent) value / x/y division /:= x/:=e x:=x/(e) : see case, see [ ] := v:=e assignment, not undone on backtracking (fail), see := NB. it returns variable v :=: x:=:y exchange, see := ; statement separator < x x<->y reversible exchange, undone on backtracking, see <- <:= x<:=e x:=x<(e), if x x>y greater than >= x>=y greater than or equal >=:= x>=:=e x:=x>=(e) >> s>>t compare lexical order >>= s>>=t lexical gt or eq ? ?0 real random number generator 0.0..1.0 ? ?n random number generator 1..n (see &random) ? ?x produce random element of string, list, table or recd ? s?e scan string s using e ?:= s?:=e s := s?(e) @ @x resume coexpression, s@x send s to x, s:= @x receives s [ ] s[e] subscript a string, list or table; "Cleo"[1:3] = "Cl" !!! \ \x succeed if x has non-null (non-absent) value \ e\n restrict generator e to at most n results ^ ^e refresh e, COPY of reinitialised coexpression e ^ x^y exponentiation ^:= x^:=e x:=x^(e) abs abs(n) absolute value of int or real any any(cset,str,i,j) i+1 if str[i] in cset else fail bal bal(c1,c2,c3,str,i,j) posns in str balanced w.r.t. c2 and c3 of c1's break leave a loop by x to y {by z} generate x to y in steps of z (or 1) case case e of {val:exp ...} case statement center center(s1,i,s2) string size i, s1 centred, s2 for padding (NOT centre) close close(f) produces f after closing it copy copy(x) copies a list, table or record, else returns x create create x create instance of a coexpression cset cset(x) converts x to char set if possible display display(i,f) writes i levels of stack to f, returns null do every e1 {do e2} evaluate e2 for each result of RESUMING e1, see while do while e1 {do e2} evaluate e2 each time e1 succeeds, see every else if e then e else e every every e1 {do e2} evaluate e2 for each result of RESUMING e1, see while exit exit(i) terminate program with status i, default i=0 fail fail backtrack; causes a PROC to fail find find(s1,s2,i,j) generate positions in s2 where s1 is found get get(a) produces left elt of a & remove it (see put, pop) global global var dec if if e then e else e image image(x) string image of x initial initial s statement s executed on first call of proc ONLY integer integer(x) converts x to int if possible left left(s1,n,s2) produces string size i, s1 at left, padded with s2 list list(n, val) = [val, val, ..., val] n times local local var declaration many many(cset,s,i,j) position in s[i:j] after leading sequence from cset map map(s1,s2,s3) string size *s1, change chars in s2 to corr' in s3 match match(s1,s2,i,j) match s1 at head of s2[i:j], return i+*s1 move move(n) move cursor +n, return skipped string next next goto beginning of enclosing loop not not e fails if e succeeds, succeeds (null) if e fails numeric numeric(x) convert to int or real if possible open open(fname {,mode}) pop pop(l) return head of l, shorten l as side-effect (see push) pos pos(i) succeeds if at position i in scanning, returns &pos pull pull(l) removes and returns rightmost elt of l if non empty push push(e,l) add e to head of l as side-effect (see pop, put) put put(a,x) return a and add to right of x (see get, push) read read(f) read a line from f, default &input, fail on eof reads reads(f,i) read i chars (or fewer) from f, fail on eof, default i=1 real real(x) convert x to real if possible record record structure declaration repeat repeat e execute e repeatedly repl repl(s,n) replicate string s n times return return {e} return from proc {func with result} reverse reverse(str) right right(s1,i,s2) return string len i, s1 at right, padded s2 sort sort(t,i) sort a table return a list of list*2,i=1=>key, 2=>entry static local static var dec stop stop(x1,x2..xn) write xi, terminate prog status 1 string string(x) convert x to string if possible suspend suspend e suspend current generator, returning each result of e system system(str) system call with string str, return exit status tab tab(n) move cursor to position n, return skipped string table table(x) create empty table, default value is x then if e then e else e to x to y {by z} generate x to y in steps of z (or 1) trim trim(s,c) return s less tail of chars in c type type(x) return string being type of x eg. "integer" until until e1 do e2 evaluate e2 each time e1 fail, fail when e1 succeeds upto upto(cset,s,i,j) return position in s of a char in cset while while e1 {do e2} evaluate e2 each time e1 succeeds, see every write write(e1,e2,...,en) write then do nl, return en writes writes(e1,e2,...) write without newline | x|y generate x or (followed by) y | |e repeated generation, |(1 to 3) 1 2 3 1 2 3 1 2 3 ... || x||y string concatenation ||:= s||:=e s := s || (e) ||| x|||y list concatenation ~ ~c complement of char set c ~= x~=y numeric not equal, returns y if succeeds ~=:= x~=:=e x:=x~=(e) ~== x~==y lexical ne ~=== x~===y produce y if value of x and y differ else fail