diff --git a/doc/comparison.tex b/doc/comparison.tex index 4116a54653..87baa06288 100644 --- a/doc/comparison.tex +++ b/doc/comparison.tex @@ -98,7 +98,7 @@ in Factor. It would be #! This is pointless do-something ; \end{verbatim} -As you might guess, \texttt{:} starts a definition and \texttt{;} ends it. Right after the colon is the name of the function we are defining here: \texttt{function}. The docstring is anything after \texttt{#!}. You have to put a \texttt{#!} at the beginning of each line. For a plain old comment, use \texttt{!} wherever you used \texttt{#}. But where did the argument go? The argument has no name; it is stored on the stack. That nameless argument is then automatically passed to another function called \texttt{do-something} and then it automatically returns the value. The fact that Factor passes arguments around automatically, basically, makes it \emph{concatenative}, and the fact that Python uses variables explicitly makes it \emph{applicative}. For a slightly more complicated example, we can look at a function that uses multiplication to square a number using multiplication. As you probably know, in Python it's +As you might guess, \texttt{:} starts a definition and \texttt{;} ends it. Right after the colon is the name of the function we are defining here: \texttt{function}. The docstring is anything after \verb|#!|. You have to put a \verb|#!| at the beginning of each line. For a plain old comment, use \texttt{!} wherever you used \verb|#|. But where did the argument go? The argument has no name; it is stored on the stack. That nameless argument is then automatically passed to another function called \texttt{do-something} and then it automatically returns the value. The fact that Factor passes arguments around automatically, basically, makes it \emph{concatenative}, and the fact that Python uses variables explicitly makes it \emph{applicative}. For a slightly more complicated example, we can look at a function that uses multiplication to square a number using multiplication. As you probably know, in Python it's \begin{verbatim} def square(x): return x*x