# HG changeset patch # User Christian Urban # Date 1575371229 0 # Node ID 0e591f806290d90f966ea0ba69b338eb2d0d180d # Parent fb4cd144a9e60a5ad602d21a2867e0096c1f09a0 updated diff -r fb4cd144a9e6 -r 0e591f806290 pics/mind2.jpg Binary file pics/mind2.jpg has changed diff -r fb4cd144a9e6 -r 0e591f806290 progs/lecture5.scala --- a/progs/lecture5.scala Tue Dec 03 01:58:19 2019 +0000 +++ b/progs/lecture5.scala Tue Dec 03 11:07:09 2019 +0000 @@ -21,7 +21,7 @@ def peop(n: BigInt): Boolean = peop(n + 1) val a = "foo" -val b = "foo" +val b = "bar" if (a == b || peop(0)) println("true") else println("false") @@ -31,6 +31,7 @@ // does not need to be re-calculated. // A useful example is + def time_needed[T](i: Int, code: => T) = { val start = System.nanoTime() for (j <- 1 to i) code @@ -156,7 +157,7 @@ enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(200).force -enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(5000000) +enum(LazyList(ZERO, ONE, CHAR('a'), CHAR('b'))).take(5_000_000) val is = @@ -165,6 +166,7 @@ .take(10).foreach(println)) + // Polymorphic Types //=================== @@ -539,6 +541,17 @@ // // http://www.latkin.org/blog/2017/05/02/when-the-scala-compiler-doesnt-help/ +val two = 0.2 +val one = 0.1 +val eight = 0.8 +val six = 0.6 + +two - one == one +eight - six == two + + + + List(1, 2, 3).contains("your cup") diff -r fb4cd144a9e6 -r 0e591f806290 slides/slides05.pdf Binary file slides/slides05.pdf has changed diff -r fb4cd144a9e6 -r 0e591f806290 slides/slides05.tex --- a/slides/slides05.tex Tue Dec 03 01:58:19 2019 +0000 +++ b/slides/slides05.tex Tue Dec 03 11:07:09 2019 +0000 @@ -462,6 +462,25 @@ \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +\begin{frame}[t] + + \begin{center} + \includegraphics[scale=0.4]{../pics/mind2.jpg} + \end{center} + + \begin{textblock}{14}(2,11.4) + \large\bf{}Mind-Blowing Programming Languages:\\ + \centering Scala\;\;? + \end{textblock} +\end{frame} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + \end{document}