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/branches/idlbasis-devel/src/system/smlnj/init/substring.sml
ViewVC logotype

Diff of /sml/branches/idlbasis-devel/src/system/smlnj/init/substring.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 871, Fri Jul 6 22:11:29 2001 UTC revision 872, Fri Jul 6 22:17:03 2001 UTC
# Line 61  Line 61 
61                else raise Core.Subscript                else raise Core.Subscript
62            end            end
63        | extract (s, i, SOME n) = substring(s, i, n)        | extract (s, i, SOME n) = substring(s, i, n)
64    
65      fun all s = SS(s, 0, stringSize s)      fun all s = SS(s, 0, stringSize s)
66        val full = all
67    
68      fun isEmpty (SS(_, _, 0)) = true      fun isEmpty (SS(_, _, 0)) = true
69        | isEmpty _ = false        | isEmpty _ = false
# Line 169  Line 171 
171              (SS(s', i, indx-i), SS(s', indx, i+n-indx))              (SS(s', i, indx-i), SS(s', indx, i+n-indx))
172            end            end
173    
174        fun isSubstring "" _ = true
175          | isSubstring s ss = size (#2 (position s ss)) <> 0
176    
177        fun isSuffix s ss = stringSize s = size (#2 (position s ss))
178    
179      fun span (SS(s1, i1, n1), SS(s2, i2, n2)) =      fun span (SS(s1, i1, n1), SS(s2, i2, n2)) =
180            if ((s1 = s2) andalso (i1 <= i2+n2))            if ((s1 = s2) andalso (i1 <= i2+n2))
181              then SS(s1, i1, (i2+n2)-i1)              then SS(s1, i1, (i2+n2)-i1)
# Line 230  Line 237 
237              iter i              iter i
238            end            end
239    
240        fun concatWith ssep l = let
241            val sep = full ssep
242            fun build [] = []
243              | build [x] = [x]
244              | build (x :: xs) = x :: sep :: build xs
245        in
246            concat (build l)
247        end
248    end    end
249  end  end
250    

Legend:
Removed from v.871  
changed lines
  Added in v.872

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0