Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System
- let lista = [1;5;7;6;4;3;5;3;63;3;52;12;7;12;3]
- let rec funkcja xs : int list =
- match xs with
- | [] -> []
- | x::y::xs -> if (x > y) then x::funkcja xs else y::funkcja xs;
- | x::xs -> x::funkcja xs;
- let rec dodej lysta i : int list =
- match lysta with
- | [] -> []
- | x::lysta -> x::i::dodej lysta i;
- let rec liczString (wyraz:string) (znak:string) (dl: int) : int =
- match dl with
- | -1 -> 0
- | dl -> if wyraz.[dl] = znak.[0] then 1 + (liczString wyraz znak (dl - 1)) else 0 + (liczString wyraz znak (dl - 1));
- let wyraz = "asdasdasdddd";
- let znak = "d";
- let dl = wyraz.Length - 1;
- let rec srednia (suma:float) (ilosc:int) =
- let liczba = Console.ReadLine()
- let liczbaC = Convert.ToDouble(liczba)
- if liczbaC = 0.0 then (
- if suma = 0.0 then Double.NaN else
- (suma / (double ilosc))
- ) else srednia (suma + liczbaC) (ilosc + 1);
- // liczenie samogłosek
- let czySamogloska (c:char) =
- match c with
- | 'a' | 'e' | 'i' | 'o' | 'u' | 'y' -> true
- | _ -> false;
- let rec liczSamogloski (wyraz:string) dl =
- match dl with
- | -1 -> 0
- | _ -> if czySamogloska (Char.ToLower(wyraz.[dl])) = true then 1 + liczSamogloski wyraz (dl - 1) else 0 + liczSamogloski wyraz (dl - 1);
- // male Litery
- let isSmall (litera:char) =
- if litera = Char.ToLower(litera) then true else false;
- let rec maleLitery (wyraz:string) (dl: int) =
- match dl with
- | -1 -> true
- | _ -> if isSmall wyraz.[dl] = true then maleLitery wyraz (dl - 1) else false;
- let rec listaCreate (n:int) (znak:char) : char list =
- match n with
- | 0 -> []
- | _ -> znak::listaCreate (n - 1) znak;
- type sumShit = { name: string; dickSize: int }
- let me = { name = "Tomek"; dickSize = 22};
- let rec threeList lista : int list =
- match lista with
- | x::y::z::xs -> (x + y + z)::threeList xs
- | x::y::xs -> (x + y)::threeList xs
- | x::xs -> x::threeList xs
- | [] -> [];
- let rec suma lista =
- match lista with
- | x::xs -> x + suma xs
- | [] -> 0;
- [<EntryPoint>]
- let main argv =
- printfn "Hello World from F#!";
- let l = [1;2;3;4;5]
- let wyraz = suma l;
- let x = listaCreate 8 'n'
- printfn "%A" wyraz;
- 0 // return an integer exit code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement