Skip to content

Instantly share code, notes, and snippets.

View harmeetsingh0013's full-sized avatar

Harmeet Singh(Taara) harmeetsingh0013

View GitHub Profile
scala> val inc = funcd _
inc: Int => Int = $$Lambda$1043/1332208607@56681eaf
scala> val inc = funcd
<console>:12: error: missing argument list for method funcd
Unapplied methods are only converted to functions when a function type is expected.
You can make this conversion explicit by writing `funcd _` or `funcd(_)` instead of `funcd`.
val inc = funcd
^
scala> List(1, 2, 3, 4, 5).map(func)
res0: List[Int] = List(2, 3, 4, 5, 6)
scala> List(1, 2, 3, 4, 5).map(funcd)
res1: List[Int] = List(2, 3, 4, 5, 6)
scala> val func = (a: Int) => a + 1
func: Int => Int = $$Lambda$1030/1250816994@3d98d138
scala> def funcd(a: Int) = a + 1
funcd: (a: Int)Int
val func = (a: Int) => a + 1
def funcd(a: Int) = a + 1
All exercises are attempted on https://coderpad.io
harmeet@harmeet-Vostro-3558:~/akka-samples/akka-cinammon$ sbt run
[info] Loading global plugins from /home/harmeet/.sbt/0.13/plugins
[info] Loading project definition from /home/harmeet/akka-samples/akka-cinammon/project
[info] Set current project to akka-cinammon (in build file:/home/harmeet/akka-samples/akka-cinammon/)
[warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list
Multiple main classes detected, select one to run:
[1] com.harmeetsingh13.actors.HelloWorldActor
[2] com.harmeetsingh13.actors.HelloWorldPoolActor
package com.harmeetsingh13.actors
import akka.actor.{Actor, ActorLogging, ActorSystem, Props}
/**
* Created by Harmeet Singh(Taara) on 1/7/17.
*/
class HelloWorldActor extends Actor with ActorLogging {
override def receive: Receive = {
cinnamon.akka {
actors {
"/user/*" {
report-by = instance
}
}
}
cinnamon.chmetrics {
reporters += "console-reporter"
}
val akkaVersion = "2.4.17"
lazy val `akka-cinammon` = project in file(".") enablePlugins (Cinnamon)
// Add the Cinnamon Agent for run and test
cinnamon in run := true
cinnamon in test := true
// Set the Cinnamon Agent log level
cinnamonLogLevel := "INFO"