Edited, memorised or added to reading queue

on 06-Oct-2014 (Mon)

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

Flashcard 149623372

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

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 149627434

Tags
#bloch-effective-java-2ed #java #java-generics
Question
Why would List<ScheduledFuture<?>> be rejected by a method:
public static <T extends Comparable<T>> T max(List<T> list)
but accepted (as intended) by this:
public static <T extends Comparable<? super T>> T max(List<? extends T> list)
?
Answer
java.util.concurrent.ScheduledFuture does not implement Comparable<ScheduledFuture>. Instead, it is a subinterface of Delayed, which extends Comparable<Delayed>. In other words, a ScheduledFuture instance isn’t merely comparable to other ScheduledFuture instances; it’s comparable to any Delayed instance, so we have to say Comparable<? super T>. Delayed is super of ScheduledFuture. It seems that the second part, List<? extends T> as a producer does not make any difference.

basically:
ScheduledFuture extends Comparable<Delayed>
where Delayed is super of ScheduledFuture

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

pdf

cannot see any pdfs







#scala #traits
traits may not have constructor parameters (also called class parameters)
statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Scala Traits
h each class must inherit from just one superclass, a class can mix in any number of traits. Traits are used to define object types by specifying the signature of the supported methods. Scala also allows traits to be partially implemented but <span>traits may not have constructor parameters. A trait definition looks just like a class definition except that it uses the keyword trait as follows: trait Equal { def isEqual(x: Any): Boolean def isNotEqual(x: Any): Boolean = !




Flashcard 149631041

Tags
#odersky-programming-in-scala-2ed #scala
Question
How to rewrite this using curried function (using compact notation)?
scala> def plainOldSum(x: Int, y: Int) = x + y
plainOldSum: (x: Int,y: Int)Int
scala> plainOldSum(1, 2)
res4: Int = 3
Answer
scala> def curriedSum(x: Int)(y: Int) = x + y
curriedSum: (x: Int)(y: Int)Int
scala> curriedSum(1)(2)
res5: Int = 3

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

pdf

cannot see any pdfs







Flashcard 149636638

Tags
#scala
Question
When a function value containing a return statement is evaluated nonlocally, [...]
Answer
the computation is dropped and the result is returned by throwing a NonLocalReturnControl[A].

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
When a function value containing a return statement is evaluated nonlocally, the computation is abandoned and the result is returned by throwing a NonLocalReturnControl[A].

Original toplevel document

tpolecat
it returns from the method it appears in. Another example: def foo: Int = { val sumR: List[Int] => Int = _.foldLeft(0)((n, m) => return n + m) sumR(List(1,2,3)) + sumR(List(4,5,6)) } scala> foo res4: Int = 1 Non-Local Return <span>When a function value containing a return statement is evaluated nonlocally, the computation is abandoned and the result is returned by throwing a NonLocalReturnControl[A]. This implementation detail escapes into the wild without much ceremony: def lazily(s: => String): String = try s catch { case t: Throwable => t.toString } def foo: String = laz







Flashcard 149636716

Tags
#default-methods #horstmann-java8-for-really-impatient #java #java8
Question
Interfaces clash. If a superinterface provides a default method, and another interface supplies a method with the same name and parameter types (default or not), then you must [...].
Answer
resolve the conflict by overriding that method

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
Interfaces clash. If a superinterface provides a default method, and another interface supplies a method with the same name and parameter types (default or not), then you must resolve the conflict by overriding that method.

Original toplevel document (pdf)

cannot see any pdfs