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 rx.Observable | |
import rx.Subscription | |
import rx.util.functions.Action1 | |
/** | |
* Created by IntelliJ IDEA. | |
* @author Mario Arias | |
* Date: 9/05/13 | |
* Time: 21:11 | |
*/ |
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 rx.Observer | |
import rx.Subscription | |
import rx.Observable | |
import rx.util.functions.* | |
fun<T> Function1<Observer<T>, Subscription>.asObservable(): Observable<T> { | |
return Observable.create(Func1<Observer<T>, Subscription>{ | |
this(it!!) | |
})!! |
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
package org.kotlinprimavera.samples.petclinic.repository.jdbc | |
import org.springframework.jdbc.core.RowMapper | |
import java.sql.ResultSet | |
import org.kotlinprimavera.jdbc.core.build | |
import org.joda.time.DateTime | |
/** | |
* Created by IntelliJ IDEA. | |
* @author Mario Arias |
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
package reactor.quickstart | |
import org.slf4j.LoggerFactory | |
import java.util.concurrent.CountDownLatch | |
import kotlin.properties.Delegates | |
import reactor.core.Environment | |
import reactor.core.spec.Reactors | |
import reactor.event.selector.Selectors | |
import reactor.event.Event | |
import java.util.concurrent.TimeUnit |
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
[Test] fun partials() { | |
val sum5ints = {(a: Int, b: Int, c: Int, d: Int, e: Int) -> a + b + c + d + e } | |
val sum4intsTo10: (Int, Int, Int, Int) -> Int = sum5ints(p5 = 10) | |
val sum3intsTo15: (Int, Int, Int) -> Int = sum4intsTo10(p4 = 5) | |
val sum2intsTo17: (Int, Int) -> Int = sum3intsTo15(p3 = 2) | |
assertEquals(sum2intsTo17(1, 2), 20) |
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 fun <P1, P2, R> Function2<P1, P2, R>.invoke(p1: | |
P1, partial2: Partial<P2> = partial()): (P2) -> R { | |
return {(p2: P2) -> this(p1, p2) } | |
} | |
public fun <P1, P2, R> Function2<P1, P2, R>.invoke(partial1: Partial<P1> = partial(), | |
p2: P2): (P1) -> R { | |
return {(p1: P1) -> this(p1, p2) } | |
} |
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
/** | |
* Marker class to be used as the representation of a non-appliled parameter | |
* | |
* Created by IntelliJ IDEA. | |
* @author Mario Arias | |
* Date: 6/09/14 | |
* Time: 11:07 | |
*/ | |
public class Partial<T> { | |
} |
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
[Test] fun testUncurrying() { | |
val sum2ints: (Int, Int) -> Int = { x, y -> x + y } | |
val curried: (Int) -> (Int) -> Int = sum2ints.curried() | |
assertEquals(curried(2)(4), 6) | |
//same type as sum2ints, | |
val back: (Int, Int) -> Int = curried.uncurried() | |
assertEquals(back(2, 4), 6) | |
assertEquals(sum2ints(2, 4), 6) | |
val sum3ints: (Int, Int, Int) -> Int = { x, y, z -> x + 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
class Bar | |
class Foo<T> | |
val b: Foo<Bar> = Foo() |
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
package org.cakesolutions.spark | |
import org.apache.spark.SparkConf | |
import org.apache.spark.api.java.JavaSparkContext | |
import scala.Tuple2 | |
fun main(args: Array<String>) { | |
val inputFile = args[0] | |
val outputFile = args[1] |
OlderNewer