I hereby claim:
- I am heliocentrist on github.
- I am heliocentrist (https://keybase.io/heliocentrist) on keybase.
- I have a public key whose fingerprint is 7A3D 9E1C 13E0 97A3 4363 9F54 6301 84C4 FED7 98D9
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
//package ch4 | |
// 4.1 | |
import scala.util.Left | |
import scala.{Either => _, Left => _, Right => _, None => _, Option => _, Some => _, _} | |
case class Some[+A](get: A) extends Option[A] | |
case object None extends Option[Nothing] |
// 2.1 | |
def fib(n: Int): Int = { | |
@annotation.tailrec | |
def go(a: Int, b: Int, n: Int): Int = | |
if (n > 0) go(b, a+b, n-1) else a | |
go(0, 1, n) | |
} |
val sumConsumer: Consumer[Int,Long] = | |
new Consumer[Int,Long] { | |
def createSubscriber(cb: Callback[Long], s: Scheduler) = { | |
val out = new Subscriber.Sync[Int] { | |
implicit val scheduler = s | |
private var sum = 0L | |
def onNext(elem: Int): Continue = { | |
sum += elem | |
Thread.sleep(20000) |
package ingestionservicemonix | |
import monix.kafka._ | |
import monix.reactive.Observable | |
import org.apache.kafka.clients.producer.ProducerRecord | |
import monix.execution.Scheduler.Implicits.global | |
import scala.concurrent.Await | |
import scala.concurrent.duration._ |
This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere… I hope to present the information you need without assuming anything.
Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!
One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.
I hereby claim:
To claim this, I am signing this object:
Beads burials and beauty