let xs = 1 :: 2 :: 3 :: 4 :: [];;
let rec nTy = function (xs, n) ->
if (xs
= []) then raise (Failure "Error")
else if (n
= 1) then List.hd xs
else nTy
(List.tl xs, n
- 1);;
nTy(xs, 2);;
let rec podzielPoN = function (xs, n) ->
let rec podzielPoN_it = function (a, b, n) ->
if (n = 0) then (b, a)
else podzielPoN_it
(List.tl a, b @
(List.hd a
:: []), n
- 1)
in podzielPoN_it(xs, [], n);;
podzielPoN (xs, 2)
let rec podzielWgMod = function (xs, n) ->
let rec podzielWgMod_it = function (xs, a, b) ->
if (xs = []) then (a, b)
else if (List.hd xs
mod n
= 0) then podzielWgMod_it
(List.tl xs, a @
(List.hd xs
:: []), b
)
else podzielWgMod_it
(List.tl xs, a, b @
(List.hd xs
:: []))
in podzielWgMod_it(xs, [], []);;
podzielWgMod(xs, 2);;
let rec coNTy = function (xs, n) ->
let rec coNTy_it = function (x, i) ->
if (x = []) then []
else if (i
= 1) then List.hd x
:: coNTy_it
(List.tl x, n
)
else coNTy_it
(List.tl x, i
- 1)
in coNTy_it(xs, n);;
coNTy(xs, 2);;
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}