Monthly Archives: January 2017

Scala for impatient Reading notes

scala for impatient

Table of contents

1.Basic
2.Control structure and function
3.Array and operations
4.Map and Array
5.Class
6.Object
7.Package and import
8.Inheritance
9.File and regular expression
10.Trait
11.Operator
12.High-order function
13.Collections
14.Pattern matching and case class
15.Annotation
16.XML
17.Type parameters
18.Advanced type
19.Analysis
20.Actor
21.Implicit conversion and implicit parameter
22.Continuations

## Basic ##

Val defines a const, var defines a variable;
Types:  
> basic numerical types, Boolean, String, classes;
> scala do not differenciate basic types and reference types like java;

Operators like (+-*/) are actually method in scala:

a + b <=> a.+(b)

function and method call:
> function call:

import scala.math._
sqrt(2)
> scala doesn’t have static method, its corresponding feature is singleton object;

> class in scala has a companion object, the methods in the companion object are similar to the static method in java;

> the brackets of the method can be omitted if there is no parameter;

Apply method
> a kind of grammar similar to method calling;

val hello = “Hello”
hello(1) // ‘e’
// equals to
hello.apply(1)

> create the object of one class with the apply method in the companion object of the class;

val num = BigInt.apply(“999999”)

Some notes:
> String objective is usually converted implicitly to a StringOps object which own many string operators. Similar to Int, Double, Char -> RichInt, RichDouble, RichChar;

“Hello”.intersect(“World”)

> O and C near the class name in scala doc, C is class and O is its companion object;

> function can be used as the parameter of the method;

def count(p: (char) => Boolean) : Int // p is a function accpet a char parameter and return True or False

s.count(_.isUpper)

## Control structure and function ##

2016 小结

今年手里的research工作主要就是扩展2个已有的work到journal还有一个新的多目标优化的调度问题。

技术方面自己研究了Akka和一些modern concurrency model。着手了在写一个基于actor的DB

12月底人品爆发,搞了一年的2篇journal终于中了。就还差手里的work了。

距离Thesis的deadline越来越近,只有不到2周时间了,手里的工作7788写了个draft,可是内容还有待完善,需要赶紧优化然后添加到thesis里面去,有的忙了。最近惨啊。

2017主要有3个目标:

1)RA的工作是和KV相关,大部分精力应该在这个

2)继续完善我的actor db

3)新技术学习:code generation,container-based scheduling,新的scheduling相关的工作得跟进。