mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
basic manual array operators
This commit is contained in:
@@ -10,12 +10,12 @@ There are six basic types: \emph{number}, \emph{boolean}, \emph{string}, \emph{
|
||||
|
||||
\emph{Number} represents real (double-precision floating-point or \emph{actually rational}) numbers. Operations on numbers follow the same rules of the underlying virtual machine\footnote{if you are not a computer person, just disregard}, and such machines must follow the IEEE 754 standard\footnote{ditto.}.
|
||||
|
||||
\emph{Boolean} is the type of the values that is either \textbf{TRUE} or \textbf{FALSE}. \textbf{number 0} and \textbf{FALSE} makes condition \emph{false}. When used in numeric context, \textbf{FALSE} will be interpreted as 0 and \textbf{TRUE} as 1.
|
||||
\emph{Boolean} is the type of the values that is either \codebf{TRUE} or \codebf{FALSE}. Number \codebf{0} and \codebf{FALSE} makes condition \emph{false}. When used in numeric context, \codebf{FALSE} will be interpreted as 0 and \codebf{TRUE} as 1.
|
||||
|
||||
\emph{String} represents immutable\footnote{cannot be altered directly} sequences of bytes. However, you can't weave them to make something like \emph{string array}\footnote{future feature\ldots maybe\ldots? Probably not\ldots}.
|
||||
|
||||
\emph{Array} represents collection of numbers in 1-- or more dimensions.
|
||||
\emph{Array} represents collection of numbers in 1- or more dimensions.
|
||||
|
||||
\emph{Generator} represents a value that automatically counts up/down whenever they have been called in For-Next loop.
|
||||
|
||||
\emph{Functions} are, well\ldots functions\footnote{This is no {\lambda}-expression; there is no way you can define local-- or anonymous variable in BASIC.}, especially user-defined ones. Functions are \emph{type} because some built-in functions will actually take \emph{functions} as arguments.
|
||||
\emph{Functions} are, well\ldots functions\footnote{This is no {\lambda}-expression; there is no way you can define local- or anonymous variable in BASIC.}, especially user-defined ones. Functions are \emph{type} because some built-in functions will actually take \emph{functions} as arguments.
|
||||
|
||||
@@ -182,10 +182,24 @@ Boolean operators operate on boolean values. If one of the operand is not boolea
|
||||
Code & Operation & Result \\
|
||||
\hline
|
||||
\condensedfont{NOT} \emph{x} & Logical negation & True if \emph{x} is false and vice versa \\
|
||||
\emph{x} \condensedfont{AND} \emph{y} & Bitwise conjunction & True if \emph{x} and \emph{y} are both true \\
|
||||
\emph{x} \condensedfont{OR} \emph{y} & Bitwise disjunction & True if \emph{x} or \emph{y} is true, or both are true \\
|
||||
\emph{x} \condensedfont{AND} \emph{y} & Bitwise conjunction & True if \emph{x} and \emph{y} are both true \\
|
||||
\emph{x} \condensedfont{OR} \emph{y} & Bitwise disjunction & True if \emph{x} or \emph{y} is true, or both are true \\
|
||||
\end{tabulary}
|
||||
|
||||
\subsection{Array Operators}
|
||||
|
||||
Array operators operate on arrays and numeric values.
|
||||
|
||||
\begin{tabulary}{\textwidth}{CLL}
|
||||
Code & Operation & Result \\
|
||||
\hline
|
||||
\emph{x} $!$ \emph{y} & Cons & Prepends a value of \emph{x} into an array of \emph{y} \\
|
||||
\emph{x} $\sim$ \emph{y} & Push & Appends a value of \emph{y} into an array of \emph{x} \\
|
||||
\emph{x} $\#$ \emph{y} & Concat & Concatenates two arrays \\
|
||||
\end{tabulary}
|
||||
|
||||
Arbitrary arrays can be constructed using empty-array constant \codebf{NIL}.
|
||||
|
||||
\section{Syntax In EBNF}
|
||||
|
||||
If you're \emph{that} into the language theory of computer science, texts above are just waste of bytes/inks/pixel-spaces/whatever; this little section should be more than enough!
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
\frenchspacing
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{10pt}
|
||||
\setlength{\parskip}{\mytextsize}
|
||||
\setsecnumdepth{subsection}
|
||||
|
||||
|
||||
@@ -72,10 +72,6 @@
|
||||
\m@mindentafterchapter\@afterheading}
|
||||
\makeatother
|
||||
|
||||
% section/chapter header spacing
|
||||
\let\oldsection\section
|
||||
\renewcommand{\section}[1]{\oldsection{#1} \vskip\baselineskip}
|
||||
|
||||
|
||||
\definecolor{lgrey}{HTML}{eeeeee}
|
||||
\sethlcolor{lgrey}
|
||||
|
||||
Reference in New Issue
Block a user