Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open Printf;;
- let a = 5;;
- let b = 5;;
- (*
- printf "%i\n" 10;;
- printf "%f\n" 10.0;;
- printf "%s\n" "ala";;
- printf "%s\n" ("ala" ^ " i kot.");;
- 1 + match [1;2;3] with
- [] -> 0
- | head ::tail -> printf "%i\n" head; head;;
- *)
- let len list =
- let rec f n = function
- | [] -> n
- | _::t -> f (n+1) t
- in
- f 0 list;;
- (*
- let rec len = function
- [] -> 0
- | _::rest -> 1 + len rest;;
- printf "%i\n" (len [1;2;3;4;5]); 0;;
- *)
- (* drukowanie listy *)
- let print_int_list l =
- let rec string_of_list l = match l with
- [] -> ""
- | h::t -> (string_of_int h)^";"^(string_of_list t)
- in
- Printf.printf "[%s]\n" (string_of_list l);;
- print_int_list [1;2;3;4];;
- print_int_list [5;4];;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement