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

Last change on this file since 135 was 135, checked in by mulligan, 10 years ago

Fixed checksum calculation check. Requires a *half add* (i.e. ignore
carry when summing), not a full add. This is not obvious from the Keil
website describing the calculation. Tested on example programs on Keil
website, and it works fine.

File size: 339 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 char_list_of_string s =
17  let str_length = String.length s in
18  let rec aux s l buff =
19    if l = str_length then
20      buff
21    else
22      aux s (l + 1) ((String.get s l)::buff)
23  in
24    List.rev $ aux s 0 []
Note: See TracBrowser for help on using the repository browser.