doc-src/TutorialI/fp.tex
changeset 11294 16481a4cc9f3
parent 11215 b44ad7e4c4d2
child 11302 9e0708bb15f7
equal deleted inserted replaced
11293:6878bb02a7f9 11294:16481a4cc9f3
   465 information is stored only in the final node associated with the string, many
   465 information is stored only in the final node associated with the string, many
   466 nodes do not carry any value. This distinction is modeled with the help
   466 nodes do not carry any value. This distinction is modeled with the help
   467 of the predefined datatype \isa{option} (see {\S}\ref{sec:option}).
   467 of the predefined datatype \isa{option} (see {\S}\ref{sec:option}).
   468 \input{Trie/document/Trie.tex}
   468 \input{Trie/document/Trie.tex}
   469 
   469 
   470 \begin{exercise}
       
   471   Write an improved version of \isa{update} that does not suffer from the
       
   472   space leak in the version above. Prove the main theorem for your improved
       
   473   \isa{update}.
       
   474 \end{exercise}
       
   475 
       
   476 \begin{exercise}
       
   477   Write a function to \emph{delete} entries from a trie. An easy solution is
       
   478   a clever modification of \isa{update} which allows both insertion and
       
   479   deletion with a single function.  Prove (a modified version of) the main
       
   480   theorem above. Optimize you function such that it shrinks tries after
       
   481   deletion, if possible.
       
   482 \end{exercise}
       
   483 
       
   484 \section{Total Recursive Functions}
   470 \section{Total Recursive Functions}
   485 \label{sec:recdef}
   471 \label{sec:recdef}
   486 \index{*recdef|(}
   472 \index{*recdef|(}
   487 
   473 
   488 Although many total functions have a natural primitive recursive definition,
   474 Although many total functions have a natural primitive recursive definition,