source: Deliverables/D4.1/Util.ml @ 137

Last change on this file since 137 was 137, checked in by mulligan, 9 years ago

Bug noticed in string conversion routine. Note added.

File size: 421 bytes
Line 
1let ($) f x = f x
2;;
3
4let (<*>) f g x = f (g x)
5;;
6
7let flip f a b = f b a
8;;
9
10let fst (a, b) = a
11;;
12
13let snd (a, b) = b
14;;
15
16let rec pad v i l =
17  match i with
18    0 -> l
19  | n -> v :: (pad v (i - 1) l)
20;;
21
22let char_list_of_string s =
23  let str_length = String.length s in
24  let rec aux s l buff =
25    if l = str_length then
26      buff
27    else
28      aux s (l + 1) ((String.get s l)::buff)
29  in
30    List.rev $ aux s 0 []
Note: See TracBrowser for help on using the repository browser.