Mercurial > urweb
comparison src/list_util.sml @ 26:4ab19c19665f
Closure conversion
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 10 Jun 2008 15:56:33 -0400 |
parents | bfa2e9ae4df8 |
children | 1c91c5e6840f |
comparison
equal
deleted
inserted
replaced
25:0a762c73824d | 26:4ab19c19665f |
---|---|
58 | S.Continue (t', s) => S.Continue (h' :: t', s) | 58 | S.Continue (t', s) => S.Continue (h' :: t', s) |
59 in | 59 in |
60 mf | 60 mf |
61 end | 61 end |
62 | 62 |
63 fun foldlMap f s = | |
64 let | |
65 fun fm (ls', s) ls = | |
66 case ls of | |
67 nil => (rev ls', s) | |
68 | h :: t => | |
69 let | |
70 val (h', s') = f (h, s) | |
71 in | |
72 fm (h' :: ls', s') t | |
73 end | |
74 in | |
75 fm ([], s) | |
76 end | |
77 | |
63 fun search f = | 78 fun search f = |
64 let | 79 let |
65 fun s ls = | 80 fun s ls = |
66 case ls of | 81 case ls of |
67 [] => NONE | 82 [] => NONE |