Commit 6d2c3195 authored by Michael Hanus 's avatar Michael Hanus
Browse files

Font typo problems for backslash and underscores resolved

parent 1e31a8fe
......@@ -188,7 +188,7 @@ more than once. Fields not named by the pattern are ignored (matched
against \code{\us}).
\translation{Using the prior definition of $pick$,\\
\code{$C$ \{ bs \} = ($C$ ($pick_1^C$ $bs$ _) \ldots{} ($pick_{k}^C$ $bs$ _))}\\
\code{$C$ \{ $bs$ \} = ($C$ ($pick_1^C$ $bs$ \us{}) \ldots{} ($pick_{k}^C$ $bs$ \us{}))}\\
where $k$ is the arity of $C$.}
\noindent
......
......@@ -123,9 +123,10 @@ not True = False
not False = True
-- Conditional $\index{conditional}$
if_then_else :: Bool -> a -> a -> a $\pindex{if_then_else}$
if_then_else :: Bool -> a -> a -> a $\pindex{if\char95{}then\char95{}else}$
if_then_else b t f = case b of True -> t
False -> f
--- Useful name for the last condition in a sequence of conditional equations.
otherwise :: Bool $\pindex{otherwise}$
otherwise = True
......@@ -551,7 +552,7 @@ sequenceIO (c:cs) = do x <- c
return (x:xs)
-- Execute a sequence of I/O actions and ignore the results:
sequenceIO_ :: [IO _] -> IO () $\pindex{sequenceIO_}$
sequenceIO_ :: [IO _] -> IO () $\pindex{sequenceIO\char95{}}$
sequenceIO_ = foldr (>>) done
-- Map an I/O action function on a list of elements.
......@@ -561,7 +562,7 @@ mapIO f = sequenceIO . map f
-- Map an I/O action function on a list of elements.
-- The results of all I/O actions are ignored.
mapIO_ :: (a -> IO _) -> [a] -> IO () $\pindex{mapIO_}$
mapIO_ :: (a -> IO _) -> [a] -> IO () $\pindex{mapIO\char95{}}$
mapIO_ f = sequenceIO_ . map f
......
......@@ -658,7 +658,7 @@ If one expression contains free variables, they are
instantiated in order to evaluate the equality.
For instance, \ccode{[John]==x} binds \code{x} to \code{[John]}
and reduces to \code{True}, but it also reduces to \code{False}
with the bindings of \code{x} to \code{[]}, \code{(Alice:_)} etc.
with the bindings of \code{x} to \code{[]}, \code{(Alice:\us{})} etc.
If one is interested only in bindings for positive solutions,
i.e., reductions to \code{True}, one can also use the predefined
......
......@@ -79,13 +79,8 @@
\newcommand{\pindex}[1]{\index{#1@{\tt #1}}} % program elements in index
\newcommand{\comment}[1]{} % ignore the argument
\newcommand{\bs}{\mbox{\char92}} % backslash
\newcommand{\caret}{\mbox{\char94}}
\newcommand{\us}{\mbox{\char95}} % underscore
% allow underscores in programs:
\catcode`\_=\active
\let_=\sb
\catcode`\_=12
\newcommand{\bs}{\code{\char92}} % backslash
\newcommand{\us}{\code{\char95}} % underscore
% commands for the syntax:
\newcommand{\sor}{\ensuremath{|} }
......
......@@ -32,15 +32,15 @@ is predefined as \code{True}
to write rules with multiple guards more nicely.
Boolean values can be used in conditionals, i.e., the
conditional function \code{if_then_else}\pindex{if_then_else}\index{conditional}
conditional function \code{if\us{}then\us{}else}\pindex{if\char95{}then\char95{}else}\index{conditional}
is predefined as
\begin{curry}
if_then_else :: Bool -> a -> a -> a
if_then_else b t f = case b of True -> t
False -> f
\end{curry}
where ``\code{if b then x else y}'' is syntactic sugar for the application
\code{(if_then_else b x y)}.
where \ccode{if b then x else y} is syntactic sugar for the application
\code{(if\us{}then\us{}else b x y)}.
Due to the definition based on a case expression
(see Section~\ref{sec-case-expressions}), the evaluation of
a conditional suspends of the discriminating Boolean argument
......@@ -71,7 +71,7 @@ compare Tail Tail = EQ
\end{curry}
Note that one can also compare expressions containing free variables.
For instance, the evaluation of \ccode{x < [Tail]} yields \code{True}
for the bindings \code{\{x=[]\}} and \code{\{x=(Head:_)\}}.
for the bindings \code{\{x=[]\}} and \code{\{x=(Head:\us{})\}}.
For built-in types like numbers or characters,
some Curry systems might suspend when comparing unknown values.
......@@ -138,7 +138,7 @@ f $! x = x `seq` f x
%
Thus, if \code{inf} is a non-terminating function
(e.g., defined by ``\code{inf = inf}'')
and \code{f} a constant function defined by ``\code{f _ = 0}'',
and \code{f} a constant function defined by \ccode{f \us{} = 0},
then the evaluation of the expression ``\code{f~\$!~inf}''
does not terminate whereas the expression ``\code{f~\$~inf}''
evaluates to \code{0}.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment