basicdoc: word position self-reference joke is now automated

This commit is contained in:
minjaesong
2020-12-27 02:24:05 +09:00
parent dce251fbc9
commit 31ae5bbbbc
2 changed files with 23 additions and 2 deletions

View File

@@ -99,7 +99,7 @@ Consider the following code:
Here, we have defined two functions to use in the program: \code{POW2} and \code{DCOS}. Also observe that functions are defined using variable \code{N}s, but we use them with \code{X} in line 40 and with \code{A} in line 80: yes, functions can have their local name so you don't have to carefully choose which variable name to use in your subroutine.
Except a function can't have statements that spans 2- or more BASIC lines; but there are ways to get around that, including \code{DO} statement and \emph{functional currying}.
Except a function can't have statements that spans two- or more BASIC lines; but there are ways to get around that, including \code{DO} statement and \emph{functional currying}\newcounter{curryingappearance}\setcounter{curryingappearance}{\value{page}}
This sample program also shows \code{FOREACH} statement, which is same as \code{FOR} but works with arrays.
@@ -153,7 +153,10 @@ Here, \code{K} will contain the values of $1!$, $2!$ \ldots\ $10!$. Right now we
\section[Currying]{Haskell Curry Wants to Know Your Location}
\label{currying101}
Two pages ago there was a mentioning about something called \emph{functional currying}. So what the fsck is currying? Consider the following code:
\newcounter{curryingselfref}
\setcounter{curryingselfref}{\value{page} - \value{curryingappearance}}
\cnttoenglish{\thecurryingselfref}{page} ago there was a mentioning about something called \emph{functional currying}. So what the fsck is currying? Consider the following code:
\begin{lstlisting}
10 DEFUN F(K,T)=ABS(T)==K

View File

@@ -31,6 +31,8 @@
\usepackage[most]{tcolorbox}
\usepackage{listings}
\usepackage{amsmath,amssymb}
\usepackage{calc}
\usepackage{ifthen}
\usepackage{lineno} % debug
@@ -131,6 +133,22 @@
tabsize=3
}
\newcommand{\cnttoenglish}[2]{{%
\ifthenelse{#1=1}{One}{%
\ifthenelse{#1=2}{Two}{%
\ifthenelse{#1=3}{Three}{%
\ifthenelse{#1=4}{Four}{%
\ifthenelse{#1=5}{Five}{%
\ifthenelse{#1=6}{Six}{%
\ifthenelse{#1=7}{Seven}{%
\ifthenelse{#1=8}{Eight}{%
\ifthenelse{#1=9}{Nine}{%
\ifthenelse{#1=10}{Ten}{%
\ifthenelse{#1=11}{Eleven}{%
\ifthenelse{#1=12}{Twelve}{%
\arabic{#1}%
}}}}}}}}}}}}} \ifthenelse{#1=1}{#2}{#2s}}
\addtocontents{toc}{\protect\thispagestyle{empty}} % no page number for the TOC header page
\aliaspagestyle{part}{empty} % aliasing PART as empty so that page number would not be printed
\aliaspagestyle{chapter}{section} % aliasing CHAPTER as section so that page numbering style would be the same as section