Home My Page Projects Code Snippets Project Openings SML/NJ
 Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

# SCM Repository

[smlnj] Diff of /sml/trunk/system/smlnj/init/pervasive.sml
 [smlnj] / sml / trunk / system / smlnj / init / pervasive.sml

# Diff of /sml/trunk/system/smlnj/init/pervasive.sml

revision 3469, Sat Dec 12 03:07:00 2009 UTC revision 3470, Mon Dec 21 17:59:10 2009 UTC
# Line 224  Line 224
224        in        in
225          loop (0, l)          loop (0, l)
226        end        end
227  fun rev l = let  fun revAppend ([], l) = l
228        fun loop ([], l) = l    | revAppend (x::r, l) = revAppend(r, x::l)
229          | loop (x::xs, l) = loop(xs, x::l)  fun rev l = revAppend(l, [])
230        in  fun foldr f b l = foldl f b (rev l)
231          loop (l, [])  fun l1 @ l2 = revAppend(rev l1, l2)
end
fun foldr f b = let
fun f2 [] = b
| f2 (a :: r) = f (a, f2 r)
in
f2
end
fun l1 @ l2 = foldr (op ::) l2 l1
232  fun app f = let  fun app f = let
233        fun a2 [] = ()        fun a2 [] = ()
234          | a2 (h :: t) = (f h : unit; a2 t)          | a2 (h :: t) = (f h : unit; a2 t)

Legend:
 Removed from v.3469 changed lines Added in v.3470