diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-06-06 14:09:30 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-06-06 14:09:30 -0400 |
commit | 3ad616e1188527cfd92bf322d5884fa633d40208 (patch) | |
tree | 1d3da14055d91262a0e36315573406b564790fdc /src/list_util.sml | |
parent | 07f80839011b33db760cdac421ccea6226b07111 (diff) |
List library additions; fix another substructure unification bug
Diffstat (limited to 'src/list_util.sml')
-rw-r--r-- | src/list_util.sml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/list_util.sml b/src/list_util.sml index a2b6aeb2..bafac51b 100644 --- a/src/list_util.sml +++ b/src/list_util.sml @@ -136,6 +136,19 @@ fun search f = s end +fun searchi f = + let + fun s n ls = + case ls of + [] => NONE + | h :: t => + case f (n, h) of + NONE => s (n + 1) t + | v => v + in + s 0 + end + fun mapi f = let fun m i acc ls = |