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 roundRobin[T](seq: IndexedSeq[T]): Stream[T] = { | |
val size = seq.size | |
Stream.from(0).map{_ % size}.map{seq(_)} | |
} |
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
int i = 0; | |
while(21 > i) printf("%d\n",i++); | |
while(1 < i) printf("%d\n",--i); |
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
module Recursion | |
//need a keyword for recursion, otherwise boilerplate free | |
//very nice | |
let rec check many acc = | |
if(0 = many) then acc | |
else | |
let a = many - 1 | |
let b = acc + many | |
check 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
//ummm... no higher kinds... what??? | |
type Functor<'A> = | |
abstract map: 'A<'B> -> ('B -> 'C) -> 'A<'C> |
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
//cannot do higher kinds so no type classes | |
//do not need higher kinds; type syntax takes care of it | |
//need higher kinds for useful free monad. | |
//no way around that? | |
module CategoryList | |
type Functor<'Type>() = | |
member this.map(l: list<'Type>)(f: 'Type -> 'Return) = | |
List.map f l | |
type Monad<'Type>(func: Functor<'Type>) = | |
member this.point(t: 'Type) = [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
module PatternMatch | |
type Type = | |
|Something of string * int | |
|Nothing | |
type Case = | |
|CaseA of a:string * b:int | |
|CaseB of a:string * b:double | |
let (|A|B|C|NOPE|) (input:char) = | |
match input with |
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
object P extends Poly1 | |
val dummy = "_dummy_" | |
def join[N <: Nat, L <: HList, AsDF <: HList]( | |
in: L, joinOn: String | |
)(implicit // | |
length: Length.Aux[L, N], | |
notZero: N GT nat._0, | |
fill: Fill.Aux[N, Task[DataFrame], AsDF], | |
mapper: Mapper.Aux[P.type, L, AsDF], | |
toList: ToList[AsDF, Task[DataFrame]], |
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
git for-each-ref --sort=-committerdate --format='[%(committerdate:short)] %(committer) | |
%(refname:short) | |
%(contents)' |