source:
Deliverables/D2.2/8051/src/ASM/Util.ml
@
486
Last change on this file since 486 was 486, checked in by , 8 years ago | |
---|---|
File size: 421 bytes |
Line | |
---|---|
1 | let ($) f x = f x |
2 | ;; |
3 | |
4 | let (<*>) f g x = f (g x) |
5 | ;; |
6 | |
7 | let flip f a b = f b a |
8 | ;; |
9 | |
10 | let fst (a, b) = a |
11 | ;; |
12 | |
13 | let snd (a, b) = b |
14 | ;; |
15 | |
16 | let rec pad v i l = |
17 | match i with |
18 | 0 -> l |
19 | | n -> v :: (pad v (i - 1) l) |
20 | ;; |
21 | |
22 | let 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.