Minor cleanup

This commit is contained in:
2023-10-04 09:42:09 -07:00
parent 0744a88c00
commit ab410dbe74
6 changed files with 73 additions and 71 deletions

View File

@ -1,18 +1,19 @@
\section{Challenges}
Do \ref{Yfac} first, then finish the rest in any order. \\
Do \ref{Yfac} first, then finish the rest in any order.
\problem{}<Yfac>
Design a recursive factorial function using $Y$. \\
Design a recursive factorial function using $Y$.
\vfill
\problem{}
Design a non-recursive factorial function. \\
Design a non-recursive factorial function. \par
\note{This one is a lot easier than \ref{Yfac}, but I don't think it will help you solve it.}
\problem{}
Using pairs, make a \say{list} data structure. Define a GET function, so that $\text{GET}~L~n$ reduces to the nth item in the list. $\text{GET}~L~0$ should give the first item in the list, and $\text{GET}~L~1$, the \textit{second}. \\
Using pairs, make a \say{list} data structure. Define a GET function, so that $\text{GET}~L~n$ reduces to the nth item in the list.
$\text{GET}~L~0$ should give the first item in the list, and $\text{GET}~L~1$, the \textit{second}. \par
Lists have a defined length, so you should be able to tell when you're on the last element.
\problem{}
@ -61,15 +62,15 @@ Write a MOD $a$ $b$ function that reduces to the remainder of $a \div b$.
\vspace{1ex}
\say{is last} is a boolean, true iff this is the last item in the list. \\
\say{item} is the thing you're storing \\
\say{next...} is another one of these list fragments. \\
\say{is last} is a boolean, true iff this is the last item in the list. \par
\say{item} is the thing you're storing \par
\say{next...} is another one of these list fragments.
It doesn't matter what \say{next} is in the last list fragment. A dedicated \say{is last} slot allows us to store ANY function in this list.
\vspace{1ex}
Here, $\text{GET} = \lm nL.[(n~L~F)~T~F$] \\
Here, $\text{GET} = \lm nL.[(n~L~F)~T~F$]
This will break if $n$ is out of range.
\end{solution}
@ -77,5 +78,5 @@ Write a MOD $a$ $b$ function that reduces to the remainder of $a \div b$.
\vfill
\problem{Bonus}
Play with \textit{Lamb}, an automatic lambda expression evaluator. \\
Play with \textit{Lamb}, an automatic lambda expression evaluator. \par
\url{https://git.betalupi.com/Mark/lamb}