\chapter{Core functions}
\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions}{}\label{md_workspace_2post-scarcity_2docs_2_core-functions}\index{Core functions@{Core functions}}
\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md31}%
\Hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md31}%
 {\itshape See \href{lispops_8h.html}{\texttt{ ops/lispops.\+h}}.}

In the specifications that follow, a word in all upper case refers to a tag value, defined on either the \href{Cons-space.html}{\texttt{ cons space}} or the \href{Vector-space.html}{\texttt{ vector space}} page.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md32}{}\doxysection{\texorpdfstring{(and args...)}{(and args...)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md32}
Public. Takes an arbitrary number of arguments. Returns true if all are readable by the current user and evaluate to non-\/\+NIL. {\itshape Note that evaluation of args may be parallelised across a number of processors, so you {\itshape cannot} use this for flow control.}\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md33}{}\doxysection{\texorpdfstring{(atom? arg)}{(atom? arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md33}
Public. Takes one argument. Returns TRUE if that argument is neither a CONS cell, a VECP, nor a STRG cell, else NIL.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md34}{}\doxysection{\texorpdfstring{(append args...)}{(append args...)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md34}
Public. Takes an arbitrary number of arguments, which should either all be CONS cells or all STRG cells. In either case returns a concatenation of all those arguments readable by the current user.

\# (assoc key store)

Public. Takes two arguments, a key and a store. The store may either be a CONS forming the head of a list formatted as an \href{Hybrid-assoc-lists.html}{\texttt{ assoc list}}, or else a VECP pointing to a HASH. If the key is readable by the current user, returns the value associated with that key in the store, if it exists and is readable by the current user, else NIL.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md35}{}\doxysection{\texorpdfstring{(car arg)}{(car arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md35}
Public. Takes one argument. If that argument is a CONS cell and is readable by the current user, returns the value indicated by the first pointer of that cell; if the argument is an STRG and is readable by the user, a CHAR representing the first character in the string; else NIL.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md36}{}\doxysection{\texorpdfstring{(cdr arg)}{(cdr arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md36}
Public. Takes one argument. If that argument is a CONS or STRG cell and is readable by the current user, returns the value indicated by the second pointer of that cell, else NIL.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md37}{}\doxysection{\texorpdfstring{(cond args...)}{(cond args...)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md37}
Public. Takes an arbitrary number of arguments each of which are lists. The arguments are examined in turn until the first element of an argument evaluates to non-\/nil; then each of the remaining elements of that argument are evaluated in turn and the value of the last element returned. If no argument has a first element which evaluates to true, returns NIL. {\itshape Note\+: this is explicit flow control and clauses will not be evaluated in parallel.}\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md38}{}\doxysection{\texorpdfstring{(cons a d)}{(cons a d)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md38}
Public. Takes two arguments, A, D. Returns a newly allocated cons cell whose first pointer points to A and whose second points to D.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md39}{}\doxysection{\texorpdfstring{(eq? a b)}{(eq? a b)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md39}
Public. Takes two arguments, A, B. Returns TRUE if both are readable by the current user and are the same cons space object (i.\+e. pointer equality), else NIL.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md40}{}\doxysection{\texorpdfstring{(eval arg)}{(eval arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md40}
Public. Takes one argument.
\begin{DoxyItemize}
\item if that argument is not readable by the current user, returns NIL.
\item if that argument is a CONS, returns the result of (apply (car arg) (cdr arg))
\item if that argument is an INTR, NIL, REAL, STRG, TRUE or VECP, returns the argument.
\item if that argument is a READ or a WRIT, {\itshape probably} returns the argument but I\textquotesingle{}m not yet certain.
\end{DoxyItemize}\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md41}{}\doxysection{\texorpdfstring{(intern str), (intern str namespace)}{(intern str), (intern str namespace)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md41}
Public.
\begin{DoxyItemize}
\item If one argument, being a STRG readable by the current user, interns that string as a symbol in the current namespace (by binding it to a special symbol {\itshape sys-\/intern}, which has its access control set NIL).
\item if two arguments, being a STRG and a VECP pointing to a HASH, interns that string in the specified hash.
\end{DoxyItemize}

{\itshape Note\+: I\textquotesingle{}m not sure what happens if the STRG is already bound in the HASH. A normal everyday HASH ought to be immutable, but namespaces can\textquotesingle{}t be immutable or else we cannot create new stuff.}\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md42}{}\doxysection{\texorpdfstring{(lambda args forms...)}{(lambda args forms...)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md42}
Public. Takes an arbitrary number of arguments. Considers the first argument (\textquotesingle{}args\textquotesingle{}) as a set of formal parameters, and returns a function composed of the forms with those parameters bound. Where I say \textquotesingle{}returns a function\textquotesingle{}, this is in initial prototyping probably an interpreted function (i.\+e. a code tree implemented as an S-\/expression), but in a usable version will mean a VECP (see \href{Cons-space.html\#VECP}{\texttt{ cons space}}) pointing to an EXEC (see \href{Vector-space.html\#EXEC}{\texttt{ vector space\+::\+EXEC}}) vector.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md43}{}\doxysection{\texorpdfstring{(nil? arg)}{(nil? arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md43}
Public. Takes one argument. Returns TRUE if the argument is NIL. May also return TRUE if the argument is not readable by the current user (on the basis that what you\textquotesingle{}re not entitled to read should appear not to exist) but this needs more thought.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md44}{}\doxysection{\texorpdfstring{(not arg)}{(not arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md44}
Public. Takes one argument. Returns TRUE if that argument is NIL, else NIL. {\itshape Note\+: Not sure what happens when the argument is not NIL but not readable by the current user. If we return NIL, as we usually do for an unreadable argument, then that\textquotesingle{}s a clue that the object exists but is not readable. Generally, when an object is not readable, it appears as though it doesn\textquotesingle{}t exist.}\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md45}{}\doxysection{\texorpdfstring{(number? arg)}{(number? arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md45}
Public. Takes one argument. Returns TRUE if the argument is readable by the current user and is an INTR, REAL, or some other sort of number I haven\textquotesingle{}t specified yet.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md46}{}\doxysection{\texorpdfstring{(or args...)}{(or args...)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md46}
Public. Takes an arbitrary number of arguments. Returns TRUE if at least one argument is readable by the current user and evaluates to non-\/\+NIL. {\itshape Note that evaluation of args may be parallelised across a number of processors, so you {\itshape cannot} use this for flow control.}

\# (print arg write-\/stream)

Public. Takes two arguments, the second of which must be a WRIT that the current user has access to. Writes the canonical printed form of the first argument to the second argument.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md47}{}\doxysection{\texorpdfstring{(quote arg)}{(quote arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md47}
Public. Takes one argument. Returns that argument, protecting it from evaluation.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md48}{}\doxysection{\texorpdfstring{(read arg)}{(read arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md48}
Public. Takes one argument. If that argument is either an STRG or a READ, parses successive characters from that argument to construct an S-\/expression in the current environment and returns it.\hypertarget{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md49}{}\doxysection{\texorpdfstring{(type arg)}{(type arg)}}\label{md_workspace_2post-scarcity_2docs_2_core-functions_autotoc_md49}
Public. Takes one argument. If that argument is readable by the current user, returns a string interned in the {\itshape core.\+types} namespace representing the tag value of the argument, unless the argument is a VECP in which case the value returned represents the tag value of the \href{Vector-space.html}{\texttt{ vector space}} object indicated by the VECP. 