Edited, memorised or added to reading queue

on 15-Aug-2014 (Fri)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Flashcard 149623379

Tags
#asset-swap #finance
Question
Asset swap (type: matched maturity) is a difference between the yield of a bond and the [...].
Answer
rate of a swap of the same maturity

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
calculating asset swap spread version 2
Asset swap is a difference between the yield of a bond and the rate of a swap of the same maturity.







Flashcard 149628406

Tags
#finance
Question
What does AUM stand for in finance?
Answer
assets under management

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
Assets under management - Wikipedia, the free encyclopedia
Jump to: navigation, search This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (June 2011) <span>In finance, assets under management (AUM), sometimes called funds under management (FUM), measures the total market value of all the financial assets which a financial institution such as a mutual fund, venture capital firm, or brokerage house manages on behalf of its clients. This metric is very popular within the financial industry and is a sign of size and success of any firm against its competition.[1] The AUM is calculated by different methods. In the mos







#scala
Classes in Scala are static templates that can be instantiated into many objects at runtime.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Classes - Scala Documentation
<span>Classes in Scala are static templates that can be instantiated into many objects at runtime. Here is a class definition which defines a class Point: class Point(xc: Int, yc: Int) { var x: Int = xc var y: Int = yc def move(dx: Int, dy: Int) { x = x + dx y = y + dy




#scala
the implicit return type Unit corresponds to void in Java-like languages
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Classes - Scala Documentation
+ dy } override def toString(): String = "(" + x + ", " + y + ")"; } The class defines two variables x and y and two methods: move and toString. move takes two integer arguments but does not return a value (<span>the implicit return type Unit corresponds to void in Java-like languages). toString, on the other hand, does not take any parameters but returns a String value. Since toString overrides the pre-defined toString method, it has to be tagged with the override fl




#scala
Since toString in user-defined class overrides the pre-defined toString method, it has to be tagged with the override flag.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Classes - Scala Documentation
move and toString. move takes two integer arguments but does not return a value (the implicit return type Unit corresponds to void in Java-like languages). toString, on the other hand, does not take any parameters but returns a String value. <span>Since toString overrides the pre-defined toString method, it has to be tagged with the override flag. Classes in Scala are parameterized with constructor arguments. The code above defines two constructor arguments, xc and yc; they are both visible in the whole body of the class. In our e




#scala
values defined with the val construct are different from variables defined with the var construct (see class Point above) in that they do not allow updates; i.e. the value is constant
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Classes - Scala Documentation
println(pt) pt.move(10, 10) println(pt) } } The program defines an executable application Classes in form of a top-level singleton object with a main method. The main method creates a new Point and stores it in value pt. Note that <span>values defined with the val construct are different from variables defined with the var construct (see class Point above) in that they do not allow updates; i.e. the value is constant. Here is the output of the program: (1, 2) (11, 12) Please enable JavaScript to view the comments powered by Disqus. blog comments powered by Disqus




#scala

Here is an example for a class hierarchy which consists of an abstract super class Term and three concrete case classes Var, Fun, and App.

abstract class Term
case class Var(name: String) extends Term
case class Fun(arg: String, body: Term) extends Term
case class App(f: Term, v: Term) extends Term

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
Scala supports the notion of case classes. Case classes are regular classes which export their constructor parameters and which provide a recursive decomposition mechanism via pattern matching. <span>Here is an example for a class hierarchy which consists of an abstract super class Term and three concrete case classes Var, Fun, and App. abstract class Term case class Var(name: String) extends Term case class Fun(arg: String, body: Term) extends Term case class App(f: Term, v: Term) extends Term This class hierarchy can be used to represent terms of the untyped lambda calculus. To facilitate the construction of case class instances, Scala does not require that the new primitive




To facilitate the construction of case class instances, Scala does not require that the new primitive is used. One can simply use the class name as a function.

Here is an example:

Fun("x", Fun("y", App(Var("x"), Var("y"))))

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
ract class Term case class Var(name: String) extends Term case class Fun(arg: String, body: Term) extends Term case class App(f: Term, v: Term) extends Term This class hierarchy can be used to represent terms of the untyped lambda calculus. <span>To facilitate the construction of case class instances, Scala does not require that the new primitive is used. One can simply use the class name as a function. Here is an example: Fun("x", Fun("y", App(Var("x"), Var("y")))) The constructor parameters of case classes are treated as public values and can be accessed directly. val x = Var("x") println(x.name) For every case class the Scala compile




#scala

The constructor parameters of case classes are treated as public values and can be accessed directly.

val x = Var("x")
println(x.name)

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
ction of case class instances, Scala does not require that the new primitive is used. One can simply use the class name as a function. Here is an example: Fun("x", Fun("y", App(Var("x"), Var("y")))) <span>The constructor parameters of case classes are treated as public values and can be accessed directly. val x = Var("x") println(x.name) For every case class the Scala compiler generates an equals method which implements structural equality and a toString method. For instance: val x1 = Var("x") val x2 = Var(&qu




#scala
For every case class the Scala compiler generates an equals method which implements structural equality and a toString method.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
xample: Fun("x", Fun("y", App(Var("x"), Var("y")))) The constructor parameters of case classes are treated as public values and can be accessed directly. val x = Var("x") println(x.name) <span>For every case class the Scala compiler generates an equals method which implements structural equality and a toString method. For instance: val x1 = Var("x") val x2 = Var("x") val y1 = Var("y") println("" + x1 + " == " + x2 + " => " + (x1 == x2)) p




#scala
It makes only sense to define case classes if pattern matching is used to decompose data structures.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
intln("" + x1 + " == " + x2 + " => " + (x1 == x2)) println("" + x1 + " == " + y1 + " => " + (x1 == y1)) will print Var(x) == Var(x) => true Var(x) == Var(y) => false <span>It makes only sense to define case classes if pattern matching is used to decompose data structures. The following object defines a pretty printer function for our lambda calculus representation: object TermTest extends scala.App { def printTerm(term: Term) { term match { c




#scala

def printTerm(term: Term) {
term match { 
case Var(n) => print(n) 
case Fun(x, b) => print("^" + x + ".") printTerm(b) 
case App(f, v) => print("(") printTerm(f) print(" ") printTerm(v) print(")") 
}

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
false It makes only sense to define case classes if pattern matching is used to decompose data structures. The following object defines a pretty printer function for our lambda calculus representation: object TermTest extends scala.App { <span>def printTerm(term: Term) { term match { case Var(n) => print(n) case Fun(x, b) => print("^" + x + ".") printTerm(b) case App(f, v) => print("(") printTerm(f) print(" ") printTerm(v) print(")") } } def isIdentityFun(term: Term): Boolean = term match { case Fun(x, Var(y)) if x == y => true case _ => false } val id = Fun("x", Var("x")) val




#scala
pattern matching statement starting with the match keyword and consisting of sequences of case Pattern => Body clauses.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
ot;)) val t = Fun("x", Fun("y", App(Var("x"), Var("y")))) printTerm(t) println println(isIdentityFun(id)) println(isIdentityFun(t)) } In our example, the function printTerm is expressed as a <span>pattern matching statement starting with the match keyword and consisting of sequences of case Pattern => Body clauses. The program above also defines a function isIdentityFun which checks if a given term corresponds to a simple identity function. This example uses deep patterns and guards. After matching




#scala
checks if a given term corresponds to a simple identity function

def isIdentityFun(term: Term): Boolean = term match { 
case Fun(x, Var(y)) if x == y => true 
case _ => false 
}

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
> print("^" + x + ".") printTerm(b) case App(f, v) => print("(") printTerm(f) print(" ") printTerm(v) print(")") } } <span>def isIdentityFun(term: Term): Boolean = term match { case Fun(x, Var(y)) if x == y => true case _ => false } val id = Fun("x", Var("x")) val t = Fun("x", Fun("y", App(Var("x"), Var("y")))) printTerm(t) println println(isIdentit




#scala
After matching a pattern with a given value, the guard (defined after the keyword if) is evaluated. If it returns true, the match succeeds; otherwise, it fails and the next pattern will be tried.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Case Classes - Scala Documentation
eyword and consisting of sequences of case Pattern => Body clauses. The program above also defines a function isIdentityFun which checks if a given term corresponds to a simple identity function. This example uses deep patterns and guards. <span>After matching a pattern with a given value, the guard (defined after the keyword if) is evaluated. If it returns true, the match succeeds; otherwise, it fails and the next pattern will be tried. Please enable JavaScript to view the comments powered by Disqus. blog comments powered by Disqus Contents




#compound-types #scala
Sometimes it is necessary to express that the type of an object is a subtype of several other types. In Scala this can be expressed with the help of compound types, which are intersections of object types.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Compound Types - Scala Documentation
<span>Sometimes it is necessary to express that the type of an object is a subtype of several other types. In Scala this can be expressed with the help of compound types, which are intersections of object types. Suppose we have two traits Cloneable and Resetable: trait Cloneable extends java.lang.Cloneable { override def clone(): Cloneable = { super.clone().asInstanceOf[Cloneable] } }




#compound-types #scala
compound type is written like this in Scala: Cloneable with Resetable
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Compound Types - Scala Documentation
it’s Cloneable then the object can be cloned, but not reset; if it’s Resetable we can reset it, but there is no clone operation. To avoid type casts in such a situation, we can specify the type of obj to be both Cloneable and Resetable. This <span>compound type is written like this in Scala: Cloneable with Resetable. Here’s the updated function: def cloneAndReset(obj: Cloneable with Resetable): Cloneable = { //... } Compound types can consist of several object types and they may have a single




#compound-types #scala

def cloneAndReset(obj: Cloneable with Resetable): Cloneable = {
  //...
}

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Compound Types - Scala Documentation
here is no clone operation. To avoid type casts in such a situation, we can specify the type of obj to be both Cloneable and Resetable. This compound type is written like this in Scala: Cloneable with Resetable. Here’s the updated function: <span>def cloneAndReset(obj: Cloneable with Resetable): Cloneable = { //... } Compound types can consist of several object types and they may have a single refinement which can be used to narrow the signature of existing object members. The general form is: A with




#compound-types #scala
what the type of the parameter obj is. If it’s Cloneable then the object can be cloned, but not reset; if it’s Resetable we can reset it, but there is no clone operation. To avoid type casts in such a situation, we can specify the type of obj to be both Cloneable and Resetable. This compound type is written like this in Scala: Cloneable with Resetable.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Compound Types - Scala Documentation
Unit } Now suppose we want to write a function cloneAndReset which takes an object, clones it and resets the original object: def cloneAndReset(obj: ?): Cloneable = { val cloned = obj.clone() obj.reset cloned } The question arises <span>what the type of the parameter obj is. If it’s Cloneable then the object can be cloned, but not reset; if it’s Resetable we can reset it, but there is no clone operation. To avoid type casts in such a situation, we can specify the type of obj to be both Cloneable and Resetable. This compound type is written like this in Scala: Cloneable with Resetable. Here’s the updated function: def cloneAndReset(obj: Cloneable with Resetable): Cloneable = { //... } Compound types can consist of several object types and they may have a single re




#compound-types #scala

Compound types can consist of several object types and they may have a single refinement which can be used to narrow the signature of existing object members. The general form is: A with B with C ... { refinement }

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Compound Types - Scala Documentation
specify the type of obj to be both Cloneable and Resetable. This compound type is written like this in Scala: Cloneable with Resetable. Here’s the updated function: def cloneAndReset(obj: Cloneable with Resetable): Cloneable = { //... } <span>Compound types can consist of several object types and they may have a single refinement which can be used to narrow the signature of existing object members. The general form is: A with B with C ... { refinement } An example for the use of refinements is given on the page about abstract types. Please enable JavaScript to view the comments powered by Disqus. blog comments powered by Dis




#scala #sequence-comprehension
Comprehensions have the form for (enumerators) yield e, where enumerators refers to a semicolon-separated list of enumerators.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Sequence Comprehensions - Scala Documentation
Scala offers a lightweight notation for expressing sequence comprehensions. <span>Comprehensions have the form for (enumerators) yield e, where enumerators refers to a semicolon-separated list of enumerators. An enumerator is either a generator which introduces new variables, or it is a filter. A comprehension evaluates the body e for each binding generated by the enumerators and returns a se




#scala #sequence-comprehension
An enumerator is either a generator which introduces new variables, or it is a filter.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Sequence Comprehensions - Scala Documentation
Scala offers a lightweight notation for expressing sequence comprehensions. Comprehensions have the form for (enumerators) yield e, where enumerators refers to a semicolon-separated list of enumerators. <span>An enumerator is either a generator which introduces new variables, or it is a filter. A comprehension evaluates the body e for each binding generated by the enumerators and returns a sequence of these values. Here is an example: object ComprehensionTest1 extends App {




#scala #sequence-comprehension
A comprehension evaluates the body e (as in for (enumerators) yield e) for each binding generated by the enumerators and returns a sequence of these values.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Sequence Comprehensions - Scala Documentation
ing sequence comprehensions. Comprehensions have the form for (enumerators) yield e, where enumerators refers to a semicolon-separated list of enumerators. An enumerator is either a generator which introduces new variables, or it is a filter. <span>A comprehension evaluates the body e for each binding generated by the enumerators and returns a sequence of these values. Here is an example: object ComprehensionTest1 extends App { def even(from: Int, to: Int): List[Int] = for (i <- List.range(from, to) if i % 2 == 0) yield i Console.println(ev




#scala #sequence-comprehension
def even(from: Int, to: Int): List[Int] = for (i <- List.range(from, to) if i % 2 == 0) yield i
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Sequence Comprehensions - Scala Documentation
ator which introduces new variables, or it is a filter. A comprehension evaluates the body e for each binding generated by the enumerators and returns a sequence of these values. Here is an example: object ComprehensionTest1 extends App { <span>def even(from: Int, to: Int): List[Int] = for (i <- List.range(from, to) if i % 2 == 0) yield i Console.println(even(0, 20)) } The for-expression in function introduces a new variable i of type Int which is subsequently bound to all values of the list List(from, from + 1, ..., to




#scala #sequence-comprehension
Every datatype that supports the operations filterWith, map, and flatMap (with the proper types) can be used in sequence comprehensions.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Sequence Comprehensions - Scala Documentation
, j); foo(20, 32) foreach { case (i, j) => println("(" + i + ", " + j + ")") } } This example shows that comprehensions are not restricted to lists. The previous program uses iterators instead. <span>Every datatype that supports the operations filterWith, map, and flatMap (with the proper types) can be used in sequence comprehensions. Here’s the output of the program: (13, 19) (14, 18) (15, 17) (16, 16) There is also a special form of sequence comprehension which returns Unit. Here the bindings that are created fro




#scala #sequence-comprehension
There is also a special form of sequence comprehension which returns Unit. Here the bindings that are created from the list of generators and filters are used to perform side-effects. The programmer has to omit the keyword yield to make use of such a sequence comprehension.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Sequence Comprehensions - Scala Documentation
program uses iterators instead. Every datatype that supports the operations filterWith, map, and flatMap (with the proper types) can be used in sequence comprehensions. Here’s the output of the program: (13, 19) (14, 18) (15, 17) (16, 16) <span>There is also a special form of sequence comprehension which returns Unit. Here the bindings that are created from the list of generators and filters are used to perform side-effects. The programmer has to omit the keyword yield to make use of such a sequence comprehension. Here’s a program which is equivalent to the previous one but uses the special for comprehension returning Unit: object ComprehensionTest3 extends App { for (i <- Iterator.range(0,




#scala #sequence-comprehension

no yield keyword - uses the special for comprehension returning Unit:

object ComprehensionTest3 extends App {
  for (i <- Iterator.range(0, 20);
       j <- Iterator.range(i, 20) if i + j == 32)
    println("(" + i + ", " + j + ")")
}
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Sequence Comprehensions - Scala Documentation
that are created from the list of generators and filters are used to perform side-effects. The programmer has to omit the keyword yield to make use of such a sequence comprehension. Here’s a program which is equivalent to the previous one but <span>uses the special for comprehension returning Unit: object ComprehensionTest3 extends App { for (i <- Iterator.range(0, 20); j <- Iterator.range(i, 20) if i + j == 32) println("(" + i + ", " + j + ")") } Please enable JavaScript to view the comments powered by Disqus. blog comments powered by Disqus Contents




#extractor-objects #scala
In Scala, patterns can be defined independently of case classes. To this end, a method named unapply is defined to yield a so-called extractor.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Extractor Objects - Scala Documentation
<span>In Scala, patterns can be defined independently of case classes. To this end, a method named unapply is defined to yield a so-called extractor. For instance, the following code defines an extractor object Twice. object Twice { def apply(x: Int): Int = x * 2 def unapply(z: Int): Option[Int] = if (z%2 == 0) Some(z/2) else Non




#extractor-objects #scala

the following code defines an extractor object Twice. The pattern case Twice(n) will cause an invocation of Twice.unapply

object Twice {
  def apply(x: Int): Int = x * 2
  def unapply(z: Int): Option[Int] = if (z%2 == 0) Some(z/2) else None
}

object TwiceTest extends App {
  val x = Twice(21)
  x match { case Twice(n) => Console.println(n) } // prints 21
} 
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Extractor Objects - Scala Documentation
In Scala, patterns can be defined independently of case classes. To this end, a method named unapply is defined to yield a so-called extractor. For instance, <span>the following code defines an extractor object Twice. object Twice { def apply(x: Int): Int = x * 2 def unapply(z: Int): Option[Int] = if (z%2 == 0) Some(z/2) else None } object TwiceTest extends App { val x = Twice(21) x match { case Twice(n) => Console.println(n) } // prints 21 } There are two syntactic conventions at work here: The pattern case Twice(n) will cause an invocation of Twice.unapply, which is used to match any even number; the return value of the u




#extractor-objects #scala
The apply method is not necessary for pattern matching. It is only used to mimick a constructor. val x = Twice(21) expands to val x = Twice.apply(21).
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Extractor Objects - Scala Documentation
use an invocation of Twice.unapply, which is used to match any even number; the return value of the unapply signals whether the argument has matched or not, and any sub-values that can be used for further matching. Here, the sub-value is z/2 <span>The apply method is not necessary for pattern matching. It is only used to mimick a constructor. val x = Twice(21) expands to val x = Twice.apply(21). The return type of an unapply should be chosen as follows: * If it is just a test, return a Boolean. For instance case even() * If it returns a single sub-value of type T, return an Opti




#generic-classes #scala
Like in Java 5, Scala has built-in support for classes parameterized with types, e.g. Stack[T]
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Generic Classes - Scala Documentation
<span>Like in Java 5 (aka. JDK 1.5), Scala has built-in support for classes parameterized with types. Such generic classes are particularly useful for the development of collection classes. Here is an example which demonstrates this: class Stack[T] { var elems: List[T] = Nil def p




#generic-classes #scala
subtyping of generic types is *invariant*. This means that if we have a stack of characters of type Stack[Char] then it cannot be used as an integer stack of type Stack[Int]. This would be unsound because it would enable us to enter true integers into the character stack.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Generic Classes - Scala Documentation
pe. Here are some usage examples: object GenericsTest extends App { val stack = new Stack[Int] stack.push(1) stack.push('a') println(stack.top) stack.pop() println(stack.top) } The output of this program will be: 97 1 Note: <span>subtyping of generic types is *invariant*. This means that if we have a stack of characters of type Stack[Char] then it cannot be used as an integer stack of type Stack[Int]. This would be unsound because it would enable us to enter true integers into the character stack. To conclude, Stack[T] is only a subtype of Stack[S] if and only if S = T. Since this can be quite restrictive, Scala offers a type parameter annotation mechanism to control the subtyping




#scala #variances
Scala supports variance annotations of type parameters of generic classes. In contrast to Java 5 (aka. JDK 1.5), variance annotations may be added when a class abstraction is defined, whereas in Java 5, variance annotations are given by clients when a class abstraction is used.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Variances - Scala Documentation
<span>Scala supports variance annotations of type parameters of generic classes. In contrast to Java 5 (aka. JDK 1.5), variance annotations may be added when a class abstraction is defined, whereas in Java 5, variance annotations are given by clients when a class abstraction is used. In the page about generic classes an example for a mutable stack was given. We explained that the type defined by the class Stack[T] is subject to invariant subtyping regarding the type




#scala #variances
the type defined by the class Stack[T] is subject to invariant subtyping regarding the type parameter.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Variances - Scala Documentation
ns may be added when a class abstraction is defined, whereas in Java 5, variance annotations are given by clients when a class abstraction is used. In the page about generic classes an example for a mutable stack was given. We explained that <span>the type defined by the class Stack[T] is subject to invariant subtyping regarding the type parameter. This can restrict the reuse of the class abstraction. We now derive a functional (i.e. immutable) implementation for stacks which does not have this restriction. Please note that this is




#scala #variances
The annotation +T declares type T to be used only in covariant positions.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Variances - Scala Documentation
= sys.error("no element on stack") override def toString() = "" } object VariancesTest extends App { var s: Stack[Any] = new Stack().push("hello"); s = s.push(new Object()) s = s.push(7) println(s) } <span>The annotation +T declares type T to be used only in covariant positions. Similarly, -T would declare T to be used only in contravariant positions. For covariant type parameters we get a covariant subtype relationship regarding this type parameter. For our exa




#scala #variances
Similarly, -T would declare T to be used only in contravariant positions.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Variances - Scala Documentation
quot;" } object VariancesTest extends App { var s: Stack[Any] = new Stack().push("hello"); s = s.push(new Object()) s = s.push(7) println(s) } The annotation +T declares type T to be used only in covariant positions. <span>Similarly, -T would declare T to be used only in contravariant positions. For covariant type parameters we get a covariant subtype relationship regarding this type parameter. For our example this means Stack[T] is a subtype of Stack[S] if T is a subtype of S.




#scala #variances
For covariant type parameters we get a covariant subtype relationship regarding this type parameter. For our example this means Stack[T] is a subtype of Stack[S] if T is a subtype of S. The opposite holds for type parameters that are tagged with a -.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Variances - Scala Documentation
w Stack().push("hello"); s = s.push(new Object()) s = s.push(7) println(s) } The annotation +T declares type T to be used only in covariant positions. Similarly, -T would declare T to be used only in contravariant positions. <span>For covariant type parameters we get a covariant subtype relationship regarding this type parameter. For our example this means Stack[T] is a subtype of Stack[S] if T is a subtype of S. The opposite holds for type parameters that are tagged with a -. For the stack example we would have to use the covariant type parameter T in a contravariant position for being able to define method push. Since we want covariant subtyping for stacks,




#implicit-parameters #scala
A method with implicit parameters can be applied to arguments just like a normal method. In this case the implicit label has no effect. However, if such a method misses arguments for its implicit parameters, such arguments will be automatically provided.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Implicit Parameters - Scala Documentation
<span>A method with implicit parameters can be applied to arguments just like a normal method. In this case the implicit label has no effect. However, if such a method misses arguments for its implicit parameters, such arguments will be automatically provided. The actual arguments that are eligible to be passed to an implicit parameter fall into two categories: * First, eligible are all identifiers x that can be accessed at the point of the me




#inner-classes #scala
In Scala it is possible to let classes have other classes as members. Opposed to Java-like languages where such inner classes are members of the enclosing class, in Scala such inner classes are bound to the outer object.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Inner Classes - Scala Documentation
<span>In Scala it is possible to let classes have other classes as members. Opposed to Java-like languages where such inner classes are members of the enclosing class, in Scala such inner classes are bound to the outer object. To illustrate the difference, we quickly sketch the implementation of a graph datatype: class Graph { class Node { var connectedNodes: List[Node] = Nil def connectTo(node: Nod




#call-by-name #functions #scala

Typically, parameters to functions are by-value parameters; that is, the value of the parameter is determined before it is passed to the function. But what if we need to write a function that accepts as a parameter an expression that we don't want evaluated until it's called within our function? For this circumstance, Scala offers call-by-name parameters.

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Functions Call-by-Name
O Scala Useful ResourcesScala Quick GuideScala Useful Resources Selected ReadingDeveloper's Best PracticesEffective Resume WritingComputer GlossaryWho is Who Scala Functions Call-by-Name Advertisements Previous Page Next Page <span>Typically, parameters to functions are by-value parameters; that is, the value of the parameter is determined before it is passed to the function. But what if we need to write a function that accepts as a parameter an expression that we don't want evaluated until it's called within our function? For this circumstance, Scala offers call-by-name parameters. A call-by-name mechanism passes a code block to the callee and each time the callee accesses the parameter, the code block is executed and the value is calculated. object Test { def m




#call-by-name #functions #scala
A call-by-name mechanism passes a code block to the callee and each time the callee accesses the parameter, the code block is executed and the value is calculated.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Functions Call-by-Name
e it is passed to the function. But what if we need to write a function that accepts as a parameter an expression that we don't want evaluated until it's called within our function? For this circumstance, Scala offers call-by-name parameters. <span>A call-by-name mechanism passes a code block to the callee and each time the callee accesses the parameter, the code block is executed and the value is calculated. object Test { def main(args: Array[String]) { delayed(time()); } def time() = { println("Getting time in nano seconds") System.nanoTime } de




#call-by-name #functions #scala
takes a call-by-name parameter by putting the => symbol between the variable name and the type.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Functions Call-by-Name
Getting time in nano seconds") System.nanoTime } def delayed( t: => Long ) = { println("In delayed method") println("Param: " + t) t } } Here, we declared the delayed method, which <span>takes a call-by-name parameter by putting the => symbol between the variable name and the type. When the above code is compiled and executed, it produces the following result: C:/>scalac Test.scala C:/>scala Test In delayed method Getting time in nano seconds Param: 813038087




#functions #scala #variable-arguments
the type of args inside the printStrings function, which is declared as type "String*" is actually Array[String].
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Function with Variable Arguments
; i = i + 1; } } } When the above code is compiled and executed, it produces the following result: C:/>scalac Test.scala C:/>scala Test Arg value[0] = Hello Arg value[1] = Scala Arg value[2] = Python C:/> Here, t<span>he type of args inside the printStrings function, which is declared as type "String*" is actually Array[String]. Previous Page Print Version PDF Version Next Page Advertisements Modern Baby Names Online Photo Editing Advertisements ASP.NET | jQuery |




#functions #scala
default parameter values in function header:
def addInt( a:Int=5, b:Int=7 ) : Int
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Default Parameter Values for a Function
e the corresponding argument will be filled in with the default. Following is an example of specifiying default parameters: object Test { def main(args: Array[String]) { println( "Returned Value : " + addInt() ); } <span>def addInt( a:Int=5, b:Int=7 ) : Int = { var sum:Int = 0 sum = a + b return sum } } When the above code is compiled and executed, it produces the following result: C:/>scalac Test.scala C:/>scal




#functions #partial-application #scala
val date = new Date
val logWithDateBound = log(date, _ : String)
logWithDateBound("message1" )
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Partially Applied Functions
ce. The result is a partially applied function that we've stored in a variable. We can now invoke this new method with only the unbound argument message as follows: import java.util.Date object Test { def main(args: Array[String]) { <span>val date = new Date val logWithDateBound = log(date, _ : String) logWithDateBound("message1" ) Thread.sleep(1000) logWithDateBound("message2" ) Thread.sleep(1000) logWithDateBound("message3" ) } def log(date: Date, message: String) = {




#functions #named-arguments #scala
In a normal function call, the arguments in the call are matched one by one in the order of the parameters of the called function. Named arguments allow you to pass arguments to a function in a different order. The syntax is simply that each argument is preceded by a parameter name and an equals sign.
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Functions with Named Arguments
Useful ResourcesScala Quick GuideScala Useful Resources Selected ReadingDeveloper's Best PracticesEffective Resume WritingComputer GlossaryWho is Who Scala Functions with Named Arguments Advertisements Previous Page Next Page <span>In a normal function call, the arguments in the call are matched one by one in the order of the parameters of the called function. Named arguments allow you to pass arguments to a function in a different order. The syntax is simply that each argument is preceded by a parameter name and an equals sign. Following is a simple example to show the concept: object Test { def main(args: Array[String]) { printInt(b=5, a=7); } def printInt( a:Int, b:Int ) = { println(&qu




#functions #named-arguments #scala
printInt(b=5, a=7);
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Functions with Named Arguments
uments to a function in a different order. The syntax is simply that each argument is preceded by a parameter name and an equals sign. Following is a simple example to show the concept: object Test { def main(args: Array[String]) { <span>printInt(b=5, a=7); } def printInt( a:Int, b:Int ) = { println("Value of a : " + a ); println("Value of b : " + b ); } } When the above code is compiled and executed,




#functions #higher-order-functions #scala
def apply(f: Int => String, v: Int) = f(v)
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Higher-Order Functions
hose result is a function. For example in the following code, apply() function takes another function f and a value v and applies function f to v: object Test { def main(args: Array[String]) { println( apply( layout, 10) ) } <span>def apply(f: Int => String, v: Int) = f(v) def layout[A](x: A) = "[" + x.toString() + "]" } When the above code is compiled and executed, it produces the following result: C:/>scalac Test.scala C:/>




Flashcard 149629021

Tags
#bonds #duration #finance
Question
For modified duration the common units are the percent change in price per one percentage point change in yield per year (for example yield going from 8% per year (y = 0.08) to 9% per year (y = 0.09)). This will give modified duration close to the value of [...]
Answer
Macaulay duration (and the same when rates are continuously compounded)

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
uration the common units are the percent change in price per one percentage point change in yield per year (for example yield going from 8% per year (y = 0.08) to 9% per year (y = 0.09)). This will give modified duration close to the value of <span>Macaulay duration (and the same when rates are continuously compounded)<span><body><html>

Original toplevel document

Bond duration - Wikipedia, the free encyclopedia
average time until repayment (measured in units of time such as years) while modified duration is a price sensitivity measure when the price is treated as a function of yield, the percentage change in price with respect to yield. Units[edit] <span>For modified duration the common units are the percent change in price per one percentage point change in yield per year (for example yield going from 8% per year (y = 0.08) to 9% per year (y = 0.09)). This will give modified duration close to the value of Macaulay duration (and the same when rates are continuously compounded). Formally, modified duration is a semi-elasticity, the percent change in price for a unit change in yield, rather than an elasticity, which is a percentage change in output for a percen







Flashcard 149629035

Tags
#bonds #finance #yield-to-maturity #z-spread
Question
Conventionally, the zero rates for calculating Z-spread are determined from the [...] curve, with semi-annual compounding.
Answer
Treasury

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
Conventionally, the zero rates for calculating Z-spread are determined from the Treasury curve, with semi-annual compounding.

Original toplevel document

Z-spread - Wikipedia, the free encyclopedia
onal factors such as liquidity and credit risk. The Z-spread quantifies the impact of these additional factors. It is the spread you need to add to the curve you are discounting with in order to generate a price that matches the market price. <span>Conventionally, the zero rates are determined from the Treasury curve, with semi-annual compounding. The Problem with YTM spreads[edit] Coupon Paying bonds are essentially portfolios of Zero Coupon Bond components and the Yield to Maturity of such instruments can be thought of as being