None

dev notes

Scala

15 Jan 2014

Tag: scala fp

Functional Programming

  def inject(arr: Array[Int],  init:Int, operation: (Int, Int) => Int): Int = {
	var carryOver = init
	arr.foreach(element => carryOver = operation(carryOver, element))
    carryOver
  }

  val array = Array(2, 3, 5, 1, 6, 4)
  val sum = inject(array, 2, (p1, p2) => p1 + p2)
  println("sum of element in array " + array + " is " + sum)

  $: sum of element in array [I@54014944 is 23

operation is function parameters with two int input parameters and return Int value

23 = init + sum of the array

Closure

Collection

Concurrent Programming

AKKA

TBD

Actor

Actors are very lightweight concurrent entities. They process messages asynchronously using an event-driven receive loop.

See Actor in <Programming in Scala 1th ed>

Unit Test

Exception Handling

Reference:

comments powered by Disqus