comparison src/list_util.sml @ 31:1c91c5e6840f

Simple signature matching
author Adam Chlipala <adamc@hcoop.net>
date Thu, 12 Jun 2008 17:16:20 -0400
parents 4ab19c19665f
children 44b5405e74c7
comparison
equal deleted inserted replaced
30:e6ccf961d8a3 31:1c91c5e6840f
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 *) 26 *)
27 27
28 structure ListUtil :> LIST_UTIL = struct 28 structure ListUtil :> LIST_UTIL = struct
29
30 fun mapfoldl f i =
31 let
32 fun mf s ls' ls =
33 case ls of
34 nil => (s, rev ls')
35 | h :: t =>
36 let
37 val (s, h') = f (h, s)
38 in
39 mf s (h' :: ls') t
40 end
41 in
42 mf i []
43 end
44 29
45 structure S = Search 30 structure S = Search
46 31
47 fun mapfold f = 32 fun mapfold f =
48 let 33 let