Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let f : int -> int = ...
- fun x y -> x + y + 1
- match someList with
- | [] -> 0
- | h::t -> 1
- > List.map (fun x -> x % 2 = 0) [1 .. 10];;
- val it : bool list
- = [false; true; false; true; false; true; false; true; false; true]
- match x with
- | 1 -> dosomething
- | _ -> dosomethingelse
- > let add a b = a + b
- val add: int -> int -> int
- > let inc = add 1
- val inc: int -> int
- val f : (int -> int) = fun n -> n * 2
- adder n x y = n + x + y
- adder 1 2 3
- adder :: Int -> Int -> Int -> Int
- five :: Int
- five = 5
- add5 = adder 5
- add5 :: Int -> Int -> Int
- addder :: Int -> (Int -> (Int -> Int))
- add5andtwomore :: Int -> (Int -> Int)
- add5andtwomore = adder 5
- add5and7andonemore :: Int -> Int
- add5and7andonemore = adder 5 7
- > add5and7andonemore 9
- => ((add5andtwomore) 7) 9
- => ((adder 5) 7) 9)
- <=> adder 5 7 9
- > adder 5 7 9 = 5 + 7 + 9
- => 5 + 7 + 9
- => 21
- > 5 + 7 + 9
- => (+ 5 (+ 7 9))
- => (+ 5 16)
- => 21
- fun x y -> x + y + 1
- (x, y) => x + y + 1;
- Int -> Int -> Int
- Int -> (Int -> Int)
- F#: let f = fun x -> x*x
- C#: Func<int, int> f = x => x * x;
- let isOne x = match x with
- | 1 -> true
- | _ -> false
Add Comment
Please, Sign In to add comment