slides/slides10.tex
changeset 704 6d9c960a2b26
parent 617 f7de0915fff2
child 744 99c5916d9a8f
equal deleted inserted replaced
703:57b3ae5ba5e2 704:6d9c960a2b26
       
     1 % !TEX program = xelatex
     1 \documentclass[dvipsnames,14pt,t]{beamer}
     2 \documentclass[dvipsnames,14pt,t]{beamer}
     2 \usepackage{../slides}
     3 \usepackage{../slides}
     3 \usepackage{../langs}
     4 \usepackage{../langs}
     4 \usepackage{../data}
     5 \usepackage{../data}
     5 \usepackage{../graphics}
     6 \usepackage{../graphics}
    48   \end{tabular}}
    49   \end{tabular}}
    49 
    50 
    50   \normalsize
    51   \normalsize
    51   \begin{center}
    52   \begin{center}
    52   \begin{tabular}{ll}
    53   \begin{tabular}{ll}
    53   Email:  & christian.urban at kcl.ac.uk\\
    54     Email:  & christian.urban at kcl.ac.uk\\
    54   Office: & N7.07 (North Wing, Bush House)\\
    55     Office Hours: & Thursdays 12 -- 14\\
    55   Slides: & KEATS (also home work is there)\\
    56     Location: & N7.07 (North Wing, Bush House)\\
       
    57     Slides \& Progs: & KEATS (also homework is there)\\  
    56   \end{tabular}
    58   \end{tabular}
    57   \end{center}
    59   \end{center}
    58 
    60 
    59 \end{frame}
    61 \end{frame}
    60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    61 
    63 
    62 
    64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
    63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    65 \begin{frame}[c,fragile]
    64 \begin{frame}[c]
    66 
    65 
    67 
    66   \Large\bf Are there more strings in \bl{$L(a^*)$} or
    68 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]
       
    69 def fact(n: Int) : Int = {
       
    70   if (n == 0) 1 else n * fact(n - 1) 
       
    71 }
       
    72 
       
    73 
       
    74 def factC(n: Int, ret: Int => Int) : Int = {
       
    75   if (n == 0) ret(1) 
       
    76   else factC(n - 1, x => ret(n * x)) 
       
    77 }
       
    78 
       
    79 fact(10)
       
    80 factC(10, identity)
       
    81 \end{lstlisting}
       
    82 \end{frame}
       
    83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    84 
       
    85 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
       
    86 \begin{frame}[c,fragile]
       
    87 
       
    88 
       
    89 \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-6mm]
       
    90 def fibC(n: Int, ret: Int => Int) : Int = {
       
    91   if (n == 0 || n == 1) ret(1) else
       
    92   fibC(n - 1,
       
    93        r1 => fibC(n - 2,
       
    94         r2 => ret(r1 + r2)))
       
    95 }
       
    96 
       
    97 fibC(10, identity)
       
    98 \end{lstlisting}
       
    99 \end{frame}
       
   100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   101 
       
   102 
       
   103 
       
   104 
       
   105 
       
   106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   107 \begin{frame}[c]
       
   108 
       
   109   \Large\bf Are there more strings in \\ \hfill\bl{$L(a^*)$} or
    67   \bl{$L((a + b)^*)$}?
   110   \bl{$L((a + b)^*)$}?
    68 
   111 
    69 \end{frame}
   112 \end{frame}
    70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   114 
       
   115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   116 \begin{frame}[c]
       
   117 \frametitle{Can you remember this HW?}
       
   118 
       
   119   \begin{itemize}
       
   120   \item (1) How many basic regular expressions are there to match
       
   121       the string \bl{$abcd$}? 
       
   122   \item (2) How many if they cannot include
       
   123       \bl{$\ONE$} and \bl{$\ZERO$}? 
       
   124   \item (3) How many if they are also not
       
   125       allowed to contain stars? 
       
   126   \item (4) How many if they are also
       
   127       not allowed to contain \bl{$\_ + \_$}?
       
   128    \end{itemize}  
       
   129 
       
   130 \end{frame}
       
   131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   132 
    71 
   133 
    72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    73 \begin{frame}[c]
   135 \begin{frame}[c]
    74 
   136 
    75 \Large\bf There are more problems, than there are
   137 \Large\bf There are more problems, than there are