Advertisement
elektryk798

Semantyka

Mar 4th, 2020
2,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.66 KB | None | 0 0
  1. // Learn more about F# at http://fsharp.org
  2.  
  3. open System
  4.  
  5. let rec (^^) x y =
  6.     match y with
  7.     | 0 -> 1
  8.     | _ -> x * (x^^(y-1))
  9.  
  10.  
  11. let rec suma (a, b) =
  12.     match b with
  13.     | 0 -> a
  14.     | _ -> a + b + suma(a, (b-1))
  15.    
  16. let tylkoMaleLitery (str:System.String) =
  17.     str.ToLower() = str
  18.  
  19. let rec mRn (m, n) =
  20.     match n with
  21.     | 0 -> 0
  22.     | 1 -> m
  23.     | _ -> m + mRn(m, n-1)
  24.  
  25. let wystOdItego(str:System.String, i, ch, start) =
  26.     match i with
  27.     | str.Length -> start
  28.     | _ -> start + wyst
  29.  
  30.  
  31.  
  32.  
  33. [<EntryPoint>]
  34. let main _ =
  35.     printf "%A" <| wystOdItego("abcaa", 2, 'a')
  36.     ignore (System.Console.ReadKey(true))
  37.     0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement