This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> val inc = funcd _ | |
inc: Int => Int = $$Lambda$1043/1332208607@56681eaf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val func = (a: Int) => a + 1 | |
def funcd(a: Int) = a + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
All exercises are attempted on https://coderpad.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cinnamon.akka { | |
actors { | |
"/user/*" { | |
report-by = instance | |
} | |
} | |
} | |
cinnamon.chmetrics { | |
reporters += "console-reporter" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |