slides/slides02.tex
author Christian Urban <urbanc@in.tum.de>
Tue, 12 Nov 2019 00:41:00 +0000
changeset 318 029e2862bb4e
parent 317 607ceabeeffc
child 319 b84ea52bfd8f
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}
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
     3
%\usepackage{chessboard}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
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}
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
     8
\usetikzlibrary{shapes}
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
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
    27
\newcommand{\UParrow}[3]{%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
    28
\begin{textblock}{0}(#2,#3)%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
    29
\onslide<#1>{%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
    30
\begin{tikzpicture}%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
    31
\node at (0,0) [single arrow, shape border rotate=90, fill=red,text=red]{a};%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
    32
\end{tikzpicture}}%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
    33
\end{textblock}}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
\begin{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
\begin{frame}[t]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
\frametitle{%
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
  \begin{tabular}{@ {}c@ {}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
  \\[5mm]
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  \huge PEP Scala (2) 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  \end{tabular}}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
  \normalsize
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  \begin{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
  \begin{tabular}{ll}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    48
    Email:  & christian.urban at kcl.ac.uk\\
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    49
    Office: & N\liningnums{7.07} (North Wing, Bush House)\bigskip\\
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    50
    Slides \& Code: & KEATS\bigskip\\
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    51
    Office Hours: &  Thursdays 12:00 -- 14:00\\
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    52
    Additionally: & (for Scala) Tuesdays 10:45 -- 11:45\\ 
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  \end{tabular}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
  \end{center}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
316
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
\begin{frame}[c,fragile]
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
    62
  \frametitle{Scala 2.13.1}
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    63
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    64
  \begin{lstlisting}[language={},numbers=none,
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    65
    basicstyle=\ttfamily\small,xleftmargin=-2mm]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    66
  $ scala
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    67
    
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    68
  Welcome to Scala 2.13.1 (Java HotSpot(TM) 
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    69
  64-Bit Server VM, Java 9). Type in expressions 
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    70
  for evaluation. Or try :help.
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    71
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    72
  scala>
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    73
  \end{lstlisting}%$
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    74
  \bigskip\bigskip
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    75
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    76
  With older versions you will get strange results with my 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
  \end{frame}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    79
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    80
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    81
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    82
\begin{frame}[c,fragile]
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    83
\frametitle{Reference Implementation}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    84
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    85
Keep your implementation and my reference implementation separate.\bigskip
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
    86
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    87
  \begin{lstlisting}[language={},numbers=none,
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    88
    basicstyle=\ttfamily\small,xleftmargin=-2mm]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    89
  $ scala -cp collatz.jar
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    90
  
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    91
  scala> CW6a.collatz(6)
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    92
  res0: Long = 8
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    93
147
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
  scala> import CW6a._
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    96
  scala> collatz(9)
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    97
  res1: Long = 19
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
    98
  \end{lstlisting}%$
202
f7bcb27d1940 updated
Christian Urban <urbanc@in.tum.de>
parents: 151
diff changeset
    99
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   100
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   101
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   102
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   103
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   104
\begin{frame}[t]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   105
  \frametitle{Preliminary Part 7}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   106
  
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   107
  \Large
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
    \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
   110
  \]\bigskip
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   111
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   112
  \large
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   113
  \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
   114
\end{frame}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   115
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   116
  
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   117
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   118
\begin{frame}[c]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   119
  \frametitle{Discussion Forum}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   120
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   121
  \large
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   122
  ``Since we can't use \code{var}s I was wondering if we could use a stack?''
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   123
  \bigskip\bigskip\bigskip\bigskip
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   124
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   125
  \small
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   126
  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
   127
\end{frame}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   128
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   129
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   130
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   131
\begin{frame}[t]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   132
  \frametitle{Email: Hate 'val'}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   133
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   134
  \mbox{}\\[-22mm]\mbox{}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   135
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   136
  \begin{center}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   137
    \begin{bubble}[10.5cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   138
    Subject: \textbf{Hate '\textbf{\texttt{val}}'}\hfill 01:00 AM\medskip\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   139
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   140
    Hello Mr Urban,\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
    I just wanted to ask, how are we suppose to work
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   143
    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
   144
    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
   145
    coursework, but how to bypass this annoying rule. What’s the whole
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   146
    point of all these coursework, when we can’t use everything Scala
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   147
    gives us?!?\medskip\\
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
    Regards.\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   150
    \mbox{}\hspace{5mm}\textcolor{black!50}{<<deleted>>}\\
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   151
    \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   152
  \end{center}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   153
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   154
\end{frame}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   155
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   156
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   157
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   158
\begin{frame}[c]
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   159
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   160
 \mbox{}\\[-25mm]\mbox{}
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   161
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   162
\begin{center}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   163
  \begin{bubble}[10.5cm]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   164
  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
   165
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   166
  \textcolor{black!70}{
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   167
    \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
   168
    yada>>}}\bigskip\bigskip\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   169
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   170
  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
   171
  \end{bubble}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   172
\end{center}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   173
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   174
\end{frame}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   175
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   176
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   177
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   178
\begin{frame}[c,fragile]
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
\begin{textblock}{6}(0.5,0.5)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   181
\begin{bubble}[11.5cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   182
  \small  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   183
  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
   184
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   185
  \textbf{Right now my is\_legal function works fine:}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   186
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   187
\footnotesize\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   188
 def is_legal(dim: Int, path: Path)(x: Pos): Boolean = {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   189
   var boolReturn = false
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   190
   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
   191
   else { var breakLoop = false
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   192
          if(path == Nil) { boolReturn = true }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   193
          else { for(i <- 0 until path.length) {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   194
                    if(breakLoop == false) {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   195
                      if(path(i) == x) {
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   196
                        boolReturn = true
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   197
                        breakLoop = true
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   198
                      }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   199
                      else { boolReturn = false }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   200
                    } else breakLoop
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   201
            }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   202
          }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   203
          boolReturn
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   204
   }
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   205
\end{lstlisting}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   206
\end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   207
\end{textblock}
204
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
\begin{textblock}{6}(8.2,11.8)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   210
\begin{bubble}[5.5cm]\footnotesize\bf
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   211
\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
   212
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
   213
\end{bubble}
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   214
\end{textblock}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   215
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   216
\only<2>{
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   217
\begin{textblock}{6}(0.3,11.8)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   218
  \begin{bubble}[3.1cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   219
    \textbf{Me:}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   220
    \raisebox{-12mm}{\includegraphics[scale=0.08]{../pics/throwup.jpg}}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   221
  \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   222
\end{textblock}}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   223
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   224
\end{frame}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   225
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   226
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   227
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   228
\begin{frame}[t,fragile]
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
\mbox{}\\[-25mm]\mbox{}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   231
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   232
\begin{textblock}{6}(0.5,2)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   233
  \begin{bubble}[11.5cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   234
  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
   235
  \small
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   236
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   237
  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
   238
  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
   239
  is not yet in the path list. How about something like\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   240
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   241
\footnotesize\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   242
 def is_legal(dim: Int, path: Path)(x: Pos): Boolean = 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   243
   ...<<some board conditions>>... && !path.contains(x)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   244
\end{lstlisting}\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   245
  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   246
  \small Does not even contain a \texttt{val}.
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   247
  \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   248
\end{textblock}
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
\begin{textblock}{6}(7,12)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   251
\footnotesize\textcolor{black!50}{(This is all on one line)}
204
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   252
\end{textblock}
9b45dd24271b updated
Christian Urban <urbanc@in.tum.de>
parents: 202
diff changeset
   253
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   254
\end{frame}
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
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   257
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   258
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   259
\begin{frame}[t,fragile]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   260
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   261
\mbox{}\\[-15mm]\mbox{}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   262
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   263
\begin{textblock}{6}(1,3)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   264
  \begin{bubble}[10.5cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   265
    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
   266
    
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   267
    THANK YOU! You made me change my coding perspective. Because of you,
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   268
    I figured out the next one\ldots
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   269
  \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   270
\end{textblock}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   271
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   272
\only<2>{
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   273
\begin{textblock}{6}(0.3,11.8)
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   274
  \begin{bubble}[3.1cm]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   275
    \textbf{Me:}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   276
    \raisebox{-12mm}{\includegraphics[scale=0.15]{../pics/happy.jpg}}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   277
  \end{bubble}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   278
\end{textblock}}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   279
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   280
\end{frame}
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
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
 
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{frame}[c]
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   287
\frametitle{Assignments}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   288
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   289
Don't change any names or types in the templates!\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   290
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   291
Avoid at all costs:
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   292
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   293
\begin{itemize}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   294
\item \code{var} 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   295
\item \code{return} 
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   296
\item \texttt{ListBuffer}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   297
\item \texttt{mutable}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   298
\item \texttt{.par}  
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   299
\end{itemize}\bigskip\bigskip
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   300
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   301
I cannot think of a good reason to use stacks.
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   302
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   303
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   304
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   305
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   306
\begin{frame}[t]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   307
\frametitle{For-Comprehensions Again}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   308
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   309
\begin{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   310
  \begin{tikzpicture}[scale=1,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   311
                      node/.style={
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   312
                      rectangle,rounded corners=3mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   313
                      very thick,draw=black!50,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   314
                      minimum height=18mm, minimum width=20mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   315
                      top color=white,bottom color=black!20}]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   316
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   317
  \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
   318
  \node (A1) at (2.3,0) {\texttt{\phantom{,}1,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   319
  \node (A2) at (3.2,0) {\texttt{\phantom{,}2,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   320
  \node (A3) at (4.1,0) {\texttt{\phantom{,}3,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   321
  \node (A4) at (5.0,0) {\texttt{\phantom{,}4,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   322
  \node (A5) at (5.9,0) {\texttt{\phantom{))}5))}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   323
  \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
   324
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   325
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   326
  \node (B0) at (1.4,-3) {\texttt{List(}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   327
  \node (B1) at (2.3,-3) {\texttt{\phantom{,}1,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   328
  \node (B2) at (3.6,-3) {\texttt{\phantom{,}4,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   329
  \node (B3) at (4.9,-3) {\texttt{\phantom{,}9,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   330
  \node (B4) at (6.2,-3) {\texttt{\phantom{,}16,}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   331
  \node (B5) at (7.5,-3) {\texttt{\phantom{,}25)}};}
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
  \draw [->,line width=1mm] (A1.south) -- (B1.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   335
  \draw [->,line width=1mm] (A2.south) -- (B2.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   336
  \draw [->,line width=1mm] (A3.south) -- (B3.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   337
  \draw [->,line width=1mm] (A4.south) -- (B4.north);
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   338
  \draw [->,line width=1mm] (A5.south) -- (B5.north);}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   339
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   340
  \onslide<2->{
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   341
  \node (Q1) at (-0.45,-0.1) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   342
  \node (Q2) at (-0.45,-2.8) {};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   343
  \node (Q3) at (-0.45,-2.95) {\alert<2->{\texttt{n\,*\,n:}}};
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   344
  \draw [->,red,line width=1mm] (Q1.south) -- (Q2.north);}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   345
 \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   346
\end{center}
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
\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
   349
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   350
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   351
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   352
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   353
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   354
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   355
\begin{frame}[t]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   356
\frametitle{For-Comprehensions Again}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   357
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   358
\begin{center}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   359
  \begin{tikzpicture}[scale=1,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   360
                      node/.style={
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   361
                      rectangle,rounded corners=3mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   362
                      very thick,draw=black!50,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   363
                      minimum height=18mm, minimum width=20mm,
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   364
                      top color=white,bottom color=black!20}]
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   365
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   366
  \node (A0) at (0,0)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   367
    {\texttt{\textcolor{purple}{\textbf{for}} (n <- List(1, 2, 3, 4, 5))
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   368
             \textcolor{purple}{\textbf{yield}} n\,*\,n}};
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
  \node (A1) at (0,-1.5) {\LARGE\textbf{vs}};       
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   371
         
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   372
  \node (A2) at (0,-3)
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   373
    {\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
   374
 \end{tikzpicture}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   375
\end{center}\bigskip
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
The second version is in case the for \textbf{does not}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   379
produce any result.
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   380
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   381
\end{frame}
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   382
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   383
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   384
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   385
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   386
\begin{frame}[c,fragile]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   387
  %\frametitle{Option Type}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   388
  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   389
  Find something below 4 in a list. What do you think Scala answers?\bigskip\bigskip
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   390
  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   391
  \begin{onlyenv}<1>
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   392
  \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   393
  List(7,2,3,4,5,6).find(_ < 4)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   394
       
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   395
  List(5,6,7,8,9).find(_ < 4)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   396
  \end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   397
  \end{onlyenv}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   398
  \begin{onlyenv}<2>
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   399
  \begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   400
  List(7,2,3,4,5,6).find(_ < 4)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   401
  res: Option[Int] = Some(2)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   402
   
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   403
  List(5,6,7,8,9).find(_ < 4)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   404
  res: Option[Int] = None
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   405
  \end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   406
  \end{onlyenv}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   407
  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   408
  \end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   409
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   410
 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   411
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   412
\begin{frame}[c]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   413
\frametitle{Option Type}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   414
    
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   415
\begin{itemize}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   416
\item if the value is present, you use\bigskip
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   417
\begin{center}\pcode{Some(value)}\end{center}\bigskip\bigskip
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   418
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   419
\item if no value is present, you use\bigskip
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   420
\begin{center}\pcode{None}\end{center}\bigskip\bigskip
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   421
\end{itemize}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   422
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   423
\small e.g.~\code{Option[Int]}, then \code{Some(42)} and \code{None}\\
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   424
good for error handling      
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   425
\end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   426
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   427
    
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   428
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   429
\begin{frame}[c,fragile]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   430
\frametitle{Option Type}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   431
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   432
\small   
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   433
\begin{onlyenv}<1>
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   434
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   435
Integer.parseInt("1234")
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   436
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   437
// vs.
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   438
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   439
def get_me_an_int(s: String) : Option[Int] = 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   440
 Try(Some(Integer.parseInt(s))).getOrElse(None)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   441
\end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   442
\end{onlyenv}\bigskip\bigskip\bigskip
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   443
 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   444
in the Scala code it is clear from the type I have to deal 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   445
with the \pcode{None}-case; no JavaDoc needed
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   446
  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   447
\end{frame}
147
72f7dd1a3754 updated
Christian Urban <urbanc@in.tum.de>
parents: 66
diff changeset
   448
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   449
 
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   451
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   452
\begin{frame}[c,fragile]
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   453
\frametitle{Higher-Order Functions}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   454
  
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   455
In Scala, functions can take other functions as arguments and can return 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   456
a function as a result.\bigskip\bigskip  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   457
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   458
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   459
List(7,2,3,4,5,6).find(_ < 4)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   460
\end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   461
    
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   462
\UParrow{1}{10}{11}    
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   463
\end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   464
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   465
  
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   466
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   467
\begin{frame}[c,fragile]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   468
\frametitle{Higher-Order Functions (2)}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   469
  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   470
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   471
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   472
def even(x: Int) : Boolean = x % 2 == 0
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   473
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   474
List(1, 2, 3, 4, 5).filter(even)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   475
  res : List[Int] = List(2, 4)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   476
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   477
List(1, 2, 3, 4, 5).count(even)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   478
  res : Int = 2
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   479
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   480
List(1, 2, 3, 4, 5).find(even)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   481
  res: Option[Int] = Some(2)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   482
\end{lstlisting}
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   483
    
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   484
\end{frame}
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   485
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   486
    
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   487
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   488
\begin{frame}[c,fragile]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   489
\frametitle{map (lower case)}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   490
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   491
 applies a function to each element of a list (and more)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   492
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   493
\begin{center}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   494
\begin{tikzpicture}[scale=0.9]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   495
                      
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   496
  \node (A0) at (1.2,0) {\texttt{List(\,}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   497
  \node (A1) at (2.0,0) {\texttt{1\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   498
  \node (A2) at (2.9,0) {\texttt{2\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   499
  \node (A3) at (3.8,0) {\texttt{3\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   500
  \node (A4) at (4.7,0) {\texttt{4\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   501
  \node (A5) at (5.6,0) {\texttt{5\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   502
  \node (A6) at (6.5,0) {\texttt{6\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   503
  \node (A7) at (7.4,0) {\texttt{7\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   504
  \node (A8) at (8.3,0) {\texttt{8)}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   505
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   506
  \node (B0) at (1.2,-3) {\texttt{List(\,}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   507
  \node (B1) at (2.0,-3) {\texttt{1\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   508
  \node (B2) at (3.0,-3) {\texttt{4\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   509
  \node (B3) at (4.1,-3) {\texttt{9\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   510
  \node (B4) at (5.2,-3) {\texttt{16\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   511
  \node (B5) at (6.3,-3) {\texttt{25\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   512
  \node (B6) at (7.4,-3) {\texttt{36\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   513
  \node (B7) at (8.4,-3) {\texttt{49\makebox[0mm]{ ,}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   514
  \node (B8) at (9.4,-3) {\texttt{64\makebox[0mm]{ )}}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   515
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   516
  \draw [->,line width=1mm] (A1.south) -- (B1.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   517
  \draw [->,line width=1mm] (A2.south) -- (B2.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   518
  \draw [->,line width=1mm] (A3.south) -- (B3.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   519
  \draw [->,line width=1mm] (A4.south) -- (B4.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   520
  \draw [->,line width=1mm] (A5.south) -- (B5.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   521
  \draw [->,line width=1mm] (A6.south) -- (B6.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   522
  \draw [->,line width=1mm] (A7.south) -- (B7.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   523
  \draw [->,line width=1mm] (A8.south) -- (B8.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   524
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   525
  \node [red] (Q0) at (-0.5,-0.3) {\large\texttt{n}}; 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   526
  \node (Q1) at (-0.5,-0.4) {};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   527
  \node (Q2) at (-0.5,-2.5) {};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   528
  \node [red] (Q3) at (-0.5,-2.65) {\large\texttt{n\,*\,n}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   529
  \draw [->,red,line width=1mm] (Q1.south) -- (Q2.north);
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   530
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   531
  \node [red] at (-1.5,-1.5) {\Large{}\it\textbf{map}};
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   532
 \end{tikzpicture}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   533
\end{center}\bigskip
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   534
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   535
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   536
List(1,2,3,4,5,6,7,8).map(n => n * n)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   537
\end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   538
\end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   539
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   540
  
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   541
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   542
\begin{frame}[c,fragile]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   543
\frametitle{For-Comprehensions are maps}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   544
  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   545
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=1mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   546
for (n <- List(1,2,3,4,5,6,7,8)) 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   547
  yield n * n
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   548
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   549
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   550
// is just syntactic sugar for
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   551
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   552
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   553
List(1,2,3,4,5,6,7,8).map(n => n * n)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   554
\end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   555
    
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   556
\end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   557
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   558
    
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   559
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   560
\begin{frame}[c,fragile]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   561
\frametitle{Map (upper case)}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   562
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   563
a type, representing a key-value association datastructure\bigskip\bigskip
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   564
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   565
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-2mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   566
val ascii = 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   567
     ('a' to 'z').map(c => (c, c.toInt))
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   568
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   569
val ascii_Map = ascii.toMap
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   570
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   571
ascii_Map.get('a')   // -> 97
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   572
\end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   573
\end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   574
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   575
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   576
\begin{frame}[c,fragile]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   577
\frametitle{Recursion}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   578
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   579
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   580
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   581
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-2mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   582
def fib(n: Int) : Int = { 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   583
  if (n == 0 || n == 1) 1
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   584
   else fib(n - 1) + fib(n - 2)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   585
}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   586
\end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   587
\end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   588
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   589
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   590
\begin{frame}[c,fragile]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   591
\frametitle{Recursion}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   592
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   593
\small
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   594
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-4mm]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   595
def my_flatten(xs: List[Option[Int]]): List[Int] = 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   596
 xs match {
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   597
   case Nil => Nil 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   598
   case None :: rest => my_flatten(rest)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   599
   case Some(v) :: rest => v :: my_flatten(rest)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   600
 }
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   601
\end{lstlisting}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   602
\end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   603
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   604
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317
607ceabeeffc updated
Christian Urban <urbanc@in.tum.de>
parents: 316
diff changeset
   605
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   606
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   607
\begin{frame}[c]
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   608
\frametitle{\begin{tabular}{c}\\[0cm]\alert{Questions?}\end{tabular}}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   609
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   610
\begin{center}
316
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   611
  \begin{tabular}[t]{@{}l@{}l@{}}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   612
    \includegraphics[scale=0.1]{../pics/mand4.png} & \hspace{4mm}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   613
    \raisebox{0mm}{\includegraphics[scale=0.1]{../pics/mand3.png}}      
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   614
  \end{tabular}     
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   615
\end{center}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   616
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   617
\begin{center}
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   618
  My Office Hours: Thursdays 12 -- 14\\
8b57dd326a91 updated
Christian Urban <urbanc@in.tum.de>
parents: 205
diff changeset
   619
  And specifically for Scala: Tuesdays 10:45 -- 11:45
148
ead6089209ba updated
Christian Urban <urbanc@in.tum.de>
parents: 147
diff changeset
   620
\end{center}
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   621
\end{frame}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   622
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   623
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   624
318
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   625
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   626
\begin{frame}[t]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   627
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   628
  \begin{center}  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   629
  \includegraphics[scale=0.3]{../pics/blow.png}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   630
  \end{center}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   631
  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   632
  \begin{textblock}{14}(2,11.4)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   633
  \large\bf{}Mind-Blowing Programming Languages:\\ 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   634
  Overloading in any language is great but it makes a difference\; \code{10/3}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   635
  \;or\; \code{10.0/3}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   636
  \end{textblock}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   637
  \end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   638
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   639
    
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   640
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   641
\begin{frame}[t]
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   642
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   643
  \begin{center}  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   644
  \includegraphics[scale=0.3]{../pics/blow.png}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   645
  \end{center}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   646
  
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   647
  \begin{textblock}{14}(2,11.4)
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   648
  \large\bf{}Mind-Blowing Programming Languages:\\ 
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   649
  \centering PHP
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   650
  \end{textblock}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   651
  \end{frame}
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   652
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   653
029e2862bb4e updated
Christian Urban <urbanc@in.tum.de>
parents: 317
diff changeset
   654
66
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   655
\end{document}
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   656
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   657
%%% Local Variables:  
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   658
%%% mode: latex
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   659
%%% TeX-master: t
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   660
%%% End: 
3506b681c191 updated
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   661