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
public final class ImmutableDummy { | |
public final Integer x; | |
public final Option<Integer> y; | |
@JsonCreator | |
public ImmutableDummy(@JsonProperty("x") Integer x, | |
@JsonProperty("y") Integer y) { | |
this.x = x; | |
this.y = Option.apply(y); |
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
function pair(a, b) { | |
return function(i) { | |
if (i === 0) return a | |
else return b | |
} | |
} | |
function head(p) { | |
return p(0) | |
} | |
function tail(p) { |
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
import akka.actor._ | |
class FibonacciGenerator extends Actor { | |
import FibonacciGenerator._ | |
def receive = fib() | |
def fib(a: Long = 0, b: Long = 1): Receive = { | |
case Next => | |
val c: Long = a + b |
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
def switch(cases, case, default_case, *args, **kwargs): | |
return cases.get(case, default_case)(*args, **kwargs) | |
def power(x): | |
return x ** 2 | |
def add(x, y): | |
return x + y | |
def illegal_operator(*args, **kwargs): |
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
from collections import Mapping | |
from itertools import ifilter | |
class Namespace(Mapping): | |
''' | |
Provides an adapter to use a class as dict, and object at the same time. | |
It allows you to use the dot notation to refer to your conf/constant, | |
yet you can use features like key-word args unpacking too. |
NewerOlder