scsh-0.5/doc/scsh-manual/miscprocs.tex

46 lines
1.4 KiB
TeX
Raw Normal View History

1995-10-13 23:34:21 -04:00
%&latex -*- latex -*-
\chapter{Miscellaneous routines}
\section{Integer bitwise ops}
1995-11-03 23:41:53 -05:00
\label{sec:bitwise}
1995-10-13 23:34:21 -04:00
\defun{arithmetic-shift} {i j} \integer
\defunx {bitwise-and} {i j} \integer
\defunx {bitwise-ior} {i j} \integer
\defunx {bitwise-not} {i} \integer
\defunx {bitwise-xor} {i j} \integer
\begin{desc}
These operations operate on integers representing semi-infinite
bit strings, using a 2's-complement encoding.
\ex{arithmetic-shift} shifts \var{i} by \var{j} bits.
A left shift is $j > 0$; a right shift is $j < 0$.
\end{desc}
\section{List procedures}
\defun{nth}{list i}\object
\begin{desc}
Returns the $i^{\mathrm th}$ element of \var{list}.
The first element (the car) is \ex{(nth \var{list} 0)},
the second element is \ex{(nth \var{list} 1)}, and so on.
This procedure is provided as it is useful for accessing elements
from the lists returned by the field-readers (chapter~\ref{chapt:fr-awk}).
\end{desc}
\section{Top level}
\defun{repl}{}\undefined
\begin{desc}
This runs a {\scm} read-eval-print loop,
reading forms from the current input port,
and writing their values to the current output port.
If you wish to try something dangerous,
and want to be able to recover your shell state, you can
fork off a subshell with the following form:
\codex{(run (begin (repl)))}
1995-11-03 23:41:53 -05:00
{\ldots}or, rephrased for the proceduralists:
\codex{(wait (fork repl))}
1995-10-13 23:34:21 -04:00
\end{desc}