SCM Repository
[smlnj] / sml / trunk / src / system / Basis / Implementation / NJ / prof-control.sml |
Diff of /sml/trunk/src/system/Basis/Implementation/NJ/prof-control.sml
Parent Directory
|
Revision Log
|
Patch
revision 1350, Fri Sep 5 21:34:27 2003 UTC | revision 1649, Tue Oct 12 22:48:53 2004 UTC | |
---|---|---|
# | Line 91 | Line 91 |
91 | }]; | }]; |
92 | ||
93 | (* count the number of newlines in a string *) | (* count the number of newlines in a string *) |
94 | fun newlines s = let | fun newlines s = |
95 | fun notNL #"\n" = false | notNL _ = true | CharVector.foldl (fn (#"\n", n) => n + 1 | (_, n) => n) 0 s |
fun f (ss, count) = let | ||
val ss = Substring.dropl notNL ss | ||
in | ||
if Substring.isEmpty ss | ||
then count | ||
else f (Substring.triml 1 ss, count+1) | ||
end | ||
in | ||
f (Substring.all s, 0) | ||
end | ||
96 | ||
97 | fun register names = let | fun register names = let |
98 | val list = !units | val list = !units |
|
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |