Advertisement
Sawy3R11

Lab1 SiWP

Feb 27th, 2019
1,374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.95 KB | None | 0 0
  1. let rec potega x y =
  2.         match y with
  3.         | 0 -> 1
  4.         | _ -> x* (potega x (y-1))
  5.  
  6. let rec suma x y =
  7.     match y with
  8.     | 0->x
  9.     | _ -> x+y+(suma x (y-1))
  10.  
  11. let rec czyMale (tekst:System.String) dlugosc =
  12.     match dlugosc with
  13.     | 0 -> System.Char.IsLower tekst.[0]
  14.     | _ -> (System.Char.IsLower tekst.[dlugosc]) & (czyMale tekst (dlugosc-1))
  15.    
  16. let rec r m n =
  17.     match n with
  18.     | 0 -> m*0
  19.     | 1 -> m*1
  20.     | _ -> m + (r m (n-1))
  21.  
  22. let rec wyst str i ch =
  23.     match i with
  24.     | str.Length -> a
  25.     | _ -> 0 + (wyst str (i+1) ch)
  26.  
  27.  
  28. [<EntryPoint>]
  29.    let main _ =
  30.     let y = "ABCDEFGHIJKL".Substring(1, 5);
  31.  
  32.  
  33.     System.Console.WriteLine (potega 2 3)
  34.     System.Console.WriteLine (suma 7 3)
  35.     System.Console.WriteLine (czyMale "dfAAAAfg" 3)
  36.     System.Console.WriteLine (r 7 3)
  37.     System.Console.WriteLine y
  38.     printf "Naciśnij klawisz..."
  39.     ignore (System.Console.ReadKey(true))
  40.     0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement