Details of Icon Functions P through R
pop (L) : x -- pop from list
Produces the leftmost element of L and removes it from L, but fails if L
is empty; synonym for get(L).
See also: get(), pull(), push(), and put()
pos (i1) : i2 -- test scanning position
Produces &pos if &pos = i1, but fails otherwise.
See also: &pos and &subject
proc (x,i) : p -- convert to procedure
Produces a procedure corresponding to the value of x, but fails if x does
not correspond to a procedure. If x is the string name of an operator, i
specifies the number of arguments: 1 for unary (prefix), 2 for binary (infix),
and 3 for ternary. proc(x,0) produces the built-in function named x even
if the global identifier having that name has been assigned another value.
proc(x,0) fails if x is not the name of a function.
Default:
i 1
See also: args()
pull (L) : x -- pull from list
Produces the rightmost element of L and removes it from L, but fails if
L is empty.
See also: get(), pop(), push(), and put()
push (L,x1,x2,...,xn) : L -- push onto list
Pushes x1, x2, ... onto the left end of L. Values are pushed in order from
left to right, so xn becomes the first (leftmost) value on L. push(L) with
no second argument pushes a null value onto L.
See also: get(), pop(), pull(), and put()
put (L,x1,x2,...,xn) : L -- put onto list
Puts x1, x2, ... onto the right end of L. Values are pushed in order from
left to right, so xn becomes the last (rightmost) value on L. put(L) with
no second argument puts a null value onto L.
See also: get(), pop(), pull(), and push()
read (f) : s -- read line
Produces the next line from f, but fails on end of file.
Default:
f &input
See also: reads()
reads (f,i) : s -- read string
Produces a string consisting of the next i characters from f, or the remaining
characters of f if fewer remain, but fails on an end of file. In reads(),
unlike read(), line termination sequences have no special significance.
reads() should be used for reading binary data. See also: read()
Defaults:
f &input
i 1
real (x) : r -- convert to real
Produces a real number resulting from type conversion of x, but fails if
the conversion is not possible.
See also: integer() and numeric()
remove (s) : n -- remove file
Removes (deletes) the file named s, but fails if s cannot be removed.
See also: rename()
rename (s1,s2) : n -- rename file
Renames the file named s1 to be s2, but fails if the renaming cannot be
done.
See also: remove()
repl (s1,i) : s2 -- replicate string
Produces a string consisting of i concatenations of s1.
reverse (s1) : s2 -- reverse string
Produces a string consisting of the reversal of s.
right (s1,i,s2) : s3 -- position string at right
Produces a string of size i in which s1 is positioned at the right, with
s2 used for padding on the left as necessary.
Defaults:
i 1
s2 " " (blank)
See also: center() and left()
rtod (r1) : r2 -- convert radians to degrees
Produces the degree equivalent of r1 given in radians.
See also: dtor()
runerr (i,x) -- terminate with run-time error
Terminates program execution with error i and offending value x.
Default:
x no offending value