SCM Repository
[smlnj] Diff of /sml/trunk/src/compiler/FLINT/opt/optutils.sml
Diff of /sml/trunk/src/compiler/FLINT/opt/optutils.sml
Parent Directory
|
Revision Log
|
Patch
13 |
|
|
14 |
(* this is a known APL function, but I don't know its real name *) |
(* this is a known APL function, but I don't know its real name *) |
15 |
val filter : bool list * 'a list -> 'a list |
val filter : bool list * 'a list -> 'a list |
16 |
|
|
17 |
|
(* A less brain-dead version of ListPair.all: returns false if |
18 |
|
* length l1 <> length l2 *) |
19 |
|
val ListPair_all : ('a * 'b -> bool) -> 'a list * 'b list -> bool |
20 |
end |
end |
21 |
|
|
22 |
structure OptUtils :> OPT_UTILS = |
structure OptUtils :> OPT_UTILS = |
43 |
| filter (false::fs,x::xs) = (filter(fs, xs)) |
| filter (false::fs,x::xs) = (filter(fs, xs)) |
44 |
| filter _ = bug "unmatched list length in filter" |
| filter _ = bug "unmatched list length in filter" |
45 |
|
|
46 |
|
fun ListPair_all pred = |
47 |
|
let fun allp (a::r1, b::r2) = pred(a, b) andalso allp (r1, r2) |
48 |
|
| allp ([],[]) = true |
49 |
|
| allp _ = false |
50 |
|
in allp |
51 |
|
end |
52 |
|
|
53 |
end |
end |
54 |
end |
end |
|
Legend:
Removed from v.198 |
|
changed lines |
|
Added in v.199 |
|
|