val
def nTy[A](xs: List[A], n: Int):A
let rec nTy =
val h::t = xs
case(Nil, _) => throw new Exception("Error")
case(_,
if (xs = []) then raise (Failure "Error")
else if (n = 1)
case(_, _) => nTy(t,
else nTy(List.tl xs, n -
}
}
nTy(xs,
def podzielPoN[A](a: List[A], n: Int): List[List[A]]
let rec podzielPoN =
def podzielPoN_tr[A](a: List[A], n: Int, b: List[A]): List[List[A]]
let rec podzielPoN_it =
if(n==0) List(b, a)
if (n = 0) then (b, a)
else
}
podzielPoN_tr(a,n, List[A]())
}
podzielPoN(xs, 2)
def podzielWgMod[A](list: List[Int], n: Int): List[List[Int]]
in podzielPoN_it(xs, [], n);;
podzielPoN (xs, 2)
let rec podzielWgMod =
def podzielWgMod_tr(xs: List[Int], a: List[Int], b: List[Int]): List[List[Int]]
let rec podzielWgMod_it =
if (xs
else if
else
}
podzielWgMod_tr(list, List(), List())
}
in podzielWgMod_it(xs, [], []);;
podzielWgMod(xs,
def coNTy[A](xs: List[A], n: Int): List[A]
let rec coNTy =
def coNTy_it[A](x: List[A], i: Int): List[A]
let rec coNTy_it =
if (x
else if (i
else
}
in coNTy_it(xs,
}
coNTy(xs,
}