comparison src/list_util.sml @ 839:b2413e4dd109

List library additions; fix another substructure unification bug
author Adam Chlipala <adamc@hcoop.net>
date Sat, 06 Jun 2009 14:09:30 -0400
parents d20d6afc1206
children 0f7e2cca6d9b
comparison
equal deleted inserted replaced
838:5154a047c6bc 839:b2413e4dd109
134 | v => v 134 | v => v
135 in 135 in
136 s 136 s
137 end 137 end
138 138
139 fun searchi f =
140 let
141 fun s n ls =
142 case ls of
143 [] => NONE
144 | h :: t =>
145 case f (n, h) of
146 NONE => s (n + 1) t
147 | v => v
148 in
149 s 0
150 end
151
139 fun mapi f = 152 fun mapi f =
140 let 153 let
141 fun m i acc ls = 154 fun m i acc ls =
142 case ls of 155 case ls of
143 [] => rev acc 156 [] => rev acc