Collaborate with your classmates on a conceptual level but do not share code. Submit individually.
- Get started with Git source code management
| import scala.util.Random | |
| import java.util.concurrent.locks.ReentrantLock | |
| def dinner(number: Int, delayInMs: Int) = | |
| val forks = Array.fill(number)(new ReentrantLock) | |
| // warning: running each philosopher in their own explicit Java thread | |
| def phil(i: Int) = new Thread { | |
| override def run(): Unit = |
| object Q extends App { val s = "object Q extends App { val s = %c%s%c ; printf(s, 0x22, s, 0x22) }" ; printf(s, 0x22, s, 0x22) } |
Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x| // simple example illustrating how to replace | |
| // https://github.com/LoyolaChicagoCode/scalamu | |
| // with https://github.com/slamdata/matryoshka | |
| // | |
| // libraryDependencies ++= Seq( | |
| // "org.scalaz" %% "scalaz-core" % "7.2.8", | |
| // "com.slamdata" %% "matryoshka-core" % "0.16.4", | |
| // "com.slamdata" %% "matryoshka-scalacheck" % "0.16.4" % Test | |
| // ) |