slides/slides02.tex
author Christian Urban <urbanc@in.tum.de>
Mon, 11 Nov 2019 14:04:22 +0000
changeset 317 607ceabeeffc
parent 316 8b57dd326a91
child 318 029e2862bb4e
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
     1
% !TEX program = xelatex
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
\documentclass[dvipsnames,14pt,t,xelatex]{beamer}
151
c5ca7f8e21a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 148
diff changeset
     3
\usepackage{chessboard}
c5ca7f8e21a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 148
diff changeset
     4
\usepackage[LSBC4,T1]{fontenc}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{../slides}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage{../graphics}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\usepackage{../langs}
151
c5ca7f8e21a5 updated
Christian Urban <urbanc@in.tum.de>
parents: 148
diff changeset
     8
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
     9
% \usepackage{../data}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\hfuzz=220pt 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
%\setmonofont[Scale=.88]{Consolas}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
%\newfontfamily{\consolas}{Consolas}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\lstset{language=Scala,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
        style=mystyle,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
        numbersep=0pt,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
        numbers=none,
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
        xleftmargin=0mm}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
\newcommand{\bl}[1]{\textcolor{blue}{#1}}     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
% beamer stuff 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
\renewcommand{\slidecaption}{PEP (Scala) 02, King's College London}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
\begin{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
\begin{frame}[t]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
\frametitle{%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
  \begin{tabular}{@ {}c@ {}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  \\[5mm]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  \huge PEP Scala (2) 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  \end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
  \normalsize
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
  \begin{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  \begin{tabular}{ll}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    41
    Email:  & christian.urban at kcl.ac.uk\\
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    42
    Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    43
    Slides \& Code: & KEATS\bigskip\\
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    44
    Office Hours: &  Thursdays 12:00 -- 14:00\\
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    45
    Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\ 
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
  \end{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    53
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    54
\begin{frame}[c,fragile]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    55
  \frametitle{My Scala Version}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    56
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    57
  \begin{lstlisting}[language={},numbers=none,
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    58
    basicstyle=\ttfamily\small,xleftmargin=-2mm]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    59
  $ scala
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    60
    
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    61
  Welcome to Scala 2.13.1 (Java HotSpot(TM) 
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    62
  64-Bit Server VM, Java 9). Type in expressions 
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    63
  for evaluation. Or try :help.
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    64
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    65
  scala>
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    66
  \end{lstlisting}%$
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    67
  \bigskip\bigskip
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    68
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    69
  With older versions you will get strange results with my reference implementation.
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    70
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    71
  \end{frame}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    72
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    73
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    75
\begin{frame}[c,fragile]
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    76
\frametitle{Reference Implementation}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    77
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    78
Keep your implementation and my reference implementation separate.\bigskip
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    79
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    80
  \begin{lstlisting}[language={},numbers=none,
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    81
    basicstyle=\ttfamily\small,xleftmargin=-2mm]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    82
  $ scala -cp collatz.jar
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    83
  
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    84
  scala> CW6a.collatz(6)
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    85
  res0: Long = 8
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    86
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    87
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    88
  scala> import CW6a._
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    89
  scala> collatz(9)
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    90
  res1: Long = 19
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    91
  \end{lstlisting}%$
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    92
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    93
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    94
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    95
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    96
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    97
\begin{frame}[t]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    98
  \frametitle{Preliminary Part 7}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    99
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   100
  \Large
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   101
  \[
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   102
    \texttt{overlap}(d_1, d_2) = \frac{d_1 \cdot d_2}{max(d_1^2, d_2^2)}  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   103
  \]\bigskip
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   104
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   105
  \large
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   106
  \quad{}\;where \;$d_1^2$\; means \;$d_1 \cdot d_1$\; and so on
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   107
\end{frame}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   108
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   109
  
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   110
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   111
\begin{frame}[c]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   112
  \frametitle{Discussion Forum}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   113
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   114
  \large
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   115
  ``Since we cant use \code{var}s I was wondering if we could use a stack?''
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   116
  \bigskip\bigskip\bigskip\bigskip
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   117
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   118
  \small
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   119
  My \pcode{collatz} and \pcode{collatz_max} functions are 4 loc each. 
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   120
\end{frame}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   121
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   122
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   123
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   124
\begin{frame}[t]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   125
  \frametitle{Email: Hate 'val'}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   126
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   127
  \mbox{}\\[-22mm]\mbox{}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   128
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   129
  \begin{center}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   130
    \begin{bubble}[10.5cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   131
    Subject: \textbf{Hate '\textbf{\texttt{val}}'}\hfill 01:00 AM\medskip\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   132
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   133
    Hello Mr Urban,\medskip\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   134
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   135
    I just wanted to ask, how are we suppose to work
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   136
    with the completely useless \textbf{\texttt{val}}, that can’t be changed ever? Why is
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   137
    this rule active at all? I’ve spent 4 hours not thinking on the
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   138
    coursework, but how to bypass this annoying rule. What’s the whole
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   139
    point of all these coursework, when we can’t use everything Scala
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   140
    gives us?!?\medskip\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   141
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   142
    Regards.\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   143
    \mbox{}\hspace{5mm}\textcolor{black!50}{<<deleted>>}\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   144
    \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   145
  \end{center}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   146
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   147
\end{frame}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   148
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   149
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   150
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   151
\begin{frame}[c]
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   152
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   153
 \mbox{}\\[-25mm]\mbox{}
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   154
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   155
\begin{center}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   156
  \begin{bubble}[10.5cm]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   157
  Subject: \textbf{Re: Hate '\textbf{\texttt{val}}'}\hfill 01:02 AM\bigskip\bigskip\\
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   158
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   159
  \textcolor{black!70}{
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   160
    \textit{\large<<my usual rant about fp\ldots\\ concurrency bla bla\ldots{} better programs
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   161
    yada>>}}\bigskip\bigskip\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   162
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   163
  PS: What are you trying to do where you desperately want to use \texttt{var}?
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   164
  \end{bubble}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   165
\end{center}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   166
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   167
\end{frame}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   168
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   169
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   170
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   171
\begin{frame}[c,fragile]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   172
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   173
\begin{textblock}{6}(0.5,0.5)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   174
\begin{bubble}[11.5cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   175
  \small  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   176
  Subject: \textbf{Re: Re: Hate '\textbf{\texttt{val}}'}\hfill 01:04 AM\medskip\\
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   177
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   178
  \textbf{Right now my is\_legal function works fine:}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   179
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   180
\footnotesize\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   181
 def is_legal(dim: Int, path: Path)(x: Pos): Boolean = {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   182
   var boolReturn = false
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   183
   if(x._1 > dim || x._2 > dim || x._1 < 0 || x._2 < 0) {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   184
   else { var breakLoop = false
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   185
          if(path == Nil) { boolReturn = true }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   186
          else { for(i <- 0 until path.length) {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   187
                    if(breakLoop == false) {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   188
                      if(path(i) == x) {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   189
                        boolReturn = true
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   190
                        breakLoop = true
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   191
                      }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   192
                      else { boolReturn = false }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   193
                    } else breakLoop
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   194
            }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   195
          }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   196
          boolReturn
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   197
   }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   198
\end{lstlisting}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   199
\end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   200
\end{textblock}
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   201
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   202
\begin{textblock}{6}(8.2,11.8)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   203
\begin{bubble}[5.5cm]\footnotesize\bf
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   204
\ldots{}but I can’t make it work with boolReturn being val. What approach would
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   205
you recommend in this case, and is using var in this case justified?
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   206
\end{bubble}
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   207
\end{textblock}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   208
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   209
\only<2>{
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   210
\begin{textblock}{6}(0.3,11.8)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   211
  \begin{bubble}[3.1cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   212
    \textbf{Me:}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   213
    \raisebox{-12mm}{\includegraphics[scale=0.08]{../pics/throwup.jpg}}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   214
  \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   215
\end{textblock}}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   216
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   217
\end{frame}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   218
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   219
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   220
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   221
\begin{frame}[t,fragile]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   222
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   223
\mbox{}\\[-25mm]\mbox{}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   224
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   225
\begin{textblock}{6}(0.5,2)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   226
  \begin{bubble}[11.5cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   227
  Subject: \textbf{Re: Re: Re: Hate '\textbf{\texttt{val}}'}\hfill 01:06 AM\bigskip\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   228
  \small
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   229
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   230
  OK. So you want to make sure that the \texttt{x}-position is not outside the
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   231
  board....and furthermore you want to make sure that the \texttt{x}-position
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   232
  is not yet in the path list. How about something like\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   233
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   234
\footnotesize\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   235
 def is_legal(dim: Int, path: Path)(x: Pos): Boolean = 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   236
   ...<<some board conditions>>... && !path.contains(x)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   237
\end{lstlisting}\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   238
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   239
  \small Does not even contain a \texttt{val}.
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   240
  \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   241
\end{textblock}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   242
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   243
\begin{textblock}{6}(7,12)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   244
\footnotesize\textcolor{black!50}{(This is all on one line)}
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   245
\end{textblock}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   246
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   247
\end{frame}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   248
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   249
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   250
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   251
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   252
\begin{frame}[t,fragile]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   253
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   254
\mbox{}\\[-15mm]\mbox{}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   255
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   256
\begin{textblock}{6}(1,3)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   257
  \begin{bubble}[10.5cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   258
    Subject: \textbf{Re: Re: Re: Re: Hate '\textbf{\texttt{val}}'}\hfill 11:02 AM\bigskip\bigskip\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   259
    
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   260
    THANK YOU! You made me change my coding perspective. Because of you,
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   261
    I figured out the next one\ldots
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   262
  \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   263
\end{textblock}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   264
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   265
\only<2>{
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   266
\begin{textblock}{6}(0.3,11.8)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   267
  \begin{bubble}[3.1cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   268
    \textbf{Me:}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   269
    \raisebox{-12mm}{\includegraphics[scale=0.15]{../pics/happy.jpg}}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   270
  \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   271
\end{textblock}}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   272
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   273
\end{frame}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   274
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   275
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   276
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   277
 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   278
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   279
\begin{frame}[c]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   280
\frametitle{Assignments}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   281
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   282
Don't change any names or types in the templates!\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   283
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   284
Avoid at all costs:
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   285
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   286
\begin{itemize}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   287
\item \code{var} 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   288
\item \code{return} 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   289
\item \texttt{ListBuffer}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   290
\item \texttt{mutable}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   291
\item \texttt{.par}  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   292
\end{itemize}\bigskip\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   293
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   294
I cannot think of a good reason to use stacks.
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   295
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   296
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   297
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   298
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   299
\begin{frame}[t]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   300
\frametitle{For-Comprehensions Again}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   301
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   302
\begin{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   303
  \begin{tikzpicture}[scale=1,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   304
                      node/.style={
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   305
                      rectangle,rounded corners=3mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   306
                      very thick,draw=black!50,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   307
                      minimum height=18mm, minimum width=20mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   308
                      top color=white,bottom color=black!20}]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   309
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   310
  \node (A0) at (0.1,0) {\texttt{\textcolor{purple}{\textbf{for}} (\alert<2->{n} <- List(}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   311
  \node (A1) at (2.3,0) {\texttt{\phantom{,}1,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   312
  \node (A2) at (3.2,0) {\texttt{\phantom{,}2,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   313
  \node (A3) at (4.1,0) {\texttt{\phantom{,}3,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   314
  \node (A4) at (5.0,0) {\texttt{\phantom{,}4,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   315
  \node (A5) at (5.9,0) {\texttt{\phantom{))}5))}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   316
  \node (A6) at (8,0) {\texttt{\textcolor{purple}{\textbf{yield}} \alert<2->{n\,*\,n}}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   317
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   318
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   319
  \node (B0) at (1.4,-3) {\texttt{List(}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   320
  \node (B1) at (2.3,-3) {\texttt{\phantom{,}1,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   321
  \node (B2) at (3.6,-3) {\texttt{\phantom{,}4,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   322
  \node (B3) at (4.9,-3) {\texttt{\phantom{,}9,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   323
  \node (B4) at (6.2,-3) {\texttt{\phantom{,}16,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   324
  \node (B5) at (7.5,-3) {\texttt{\phantom{,}25)}};}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   325
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   326
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   327
  \draw [->,line width=1mm] (A1.south) -- (B1.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   328
  \draw [->,line width=1mm] (A2.south) -- (B2.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   329
  \draw [->,line width=1mm] (A3.south) -- (B3.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   330
  \draw [->,line width=1mm] (A4.south) -- (B4.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   331
  \draw [->,line width=1mm] (A5.south) -- (B5.north);}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   332
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   333
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   334
  \node (Q1) at (-0.45,-0.1) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   335
  \node (Q2) at (-0.45,-2.8) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   336
  \node (Q3) at (-0.45,-2.95) {\alert<2->{\texttt{n\,*\,n:}}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   337
  \draw [->,red,line width=1mm] (Q1.south) -- (Q2.north);}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   338
 \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   339
\end{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   340
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   341
\onslide<3>{This is for when the for-comprehension\\ \textbf{yields / produces} a result.}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   342
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   343
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   344
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   345
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   346
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   347
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   348
\begin{frame}[t]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   349
\frametitle{For-Comprehensions Again}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   350
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   351
\begin{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   352
  \begin{tikzpicture}[scale=1,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   353
                      node/.style={
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   354
                      rectangle,rounded corners=3mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   355
                      very thick,draw=black!50,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   356
                      minimum height=18mm, minimum width=20mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   357
                      top color=white,bottom color=black!20}]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   358
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   359
  \node (A0) at (0,0)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   360
    {\texttt{\textcolor{purple}{\textbf{for}} (n <- List(1, 2, 3, 4, 5))
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   361
             \textcolor{purple}{\textbf{yield}} n\,*\,n}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   362
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   363
  \node (A1) at (0,-1.5) {\LARGE\textbf{vs}};       
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   364
         
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   365
  \node (A2) at (0,-3)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   366
    {\texttt{\textcolor{purple}{\textbf{for}} (n <- List(1, 2, 3, 4, 5)) println(n)}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   367
 \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   368
\end{center}\bigskip
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   369
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   370
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   371
The second version is in case the for \textbf{does not}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   372
produce any result.
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   373
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   374
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   375
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   376
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   377
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   378
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   379
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
\begin{frame}[t]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   381
\frametitle{Option Type}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   382
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   383
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   384
  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   385
\end{frame}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   386
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   387
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   388
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   389
\begin{frame}[t]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   390
\frametitle{Higher-Order Functions}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   391
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   392
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   393
    
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   394
\end{frame}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   395
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   396
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   397
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   398
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   399
\begin{frame}[c]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   400
\frametitle{\begin{tabular}{c}\\[0cm]\alert{Questions?}\end{tabular}}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   402
\begin{center}
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   403
  \begin{tabular}[t]{@{}l@{}l@{}}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   404
    \includegraphics[scale=0.1]{../pics/mand4.png} & \hspace{4mm}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   405
    \raisebox{0mm}{\includegraphics[scale=0.1]{../pics/mand3.png}}      
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   406
  \end{tabular}     
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   407
\end{center}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   408
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   409
\begin{center}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   410
  My Office Hours: Thursdays 12 -- 14\\
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   411
  And specifically for Scala: Tuesdays 10:45 -- 11:45
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   412
\end{center}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   413
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   414
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   415
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   416
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   417
\end{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   418
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   419
%%% Local Variables:  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   420
%%% mode: latex
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
%%% TeX-master: t
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
%%% End: 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423