Default parameters, function type examples fixed, tuples with named entries

This commit is contained in:
Andrey Breslav
2010-11-25 16:51:30 +03:00
parent 73b12271c0
commit dd49fc6ce2
8 changed files with 84 additions and 18 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
type Comparison<in T> = {T, T => Int}
type Comparison<in T> = {(T, T) : Int}
fun naturalOrder<in T : IComparable<T>>(a : T, b : T) : Int = a.compareTo(b)
@@ -8,7 +8,7 @@ enum class ComparisonResult {
LS,EQ, GR
}
type MatchableComparison<in T> = {T, T, => ComparisonResult}
type MatchableComparison<in T> = {(T, T) : ComparisonResult}
fun asMatchableComparison<T>(cmp : Comparison<T>) : MatchableComparison<T> = {a, b =>
val res = cmp(a, b)