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/src/system/Basis/Implementation/string.sml
ViewVC logotype

Diff of /sml/trunk/src/system/Basis/Implementation/string.sml

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

revision 1154, Wed Mar 20 20:44:43 2002 UTC revision 1155, Wed Mar 20 20:52:51 2002 UTC
# Line 205  Line 205 
205          in          in
206              PreString.isPrefix (s1, s2, sz2 - size s1, sz2)              PreString.isPrefix (s1, s2, sz2 - size s1, sz2)
207          end          end
208      fun isSubstring s1 s2 =   (* FIXME: should we do KMP or BM here... (?) *)      fun isSubstring s = let
209          let val sz2 = size s2          val stringsearch = PreString.kmp s
210              val stop = sz2 - size s1          fun search s' = stringsearch (s', 0, size s') >= 0
             fun matches_at_or_after i =  
                 i < stop andalso  
                 (PreString.isPrefix (s1, s2, i, sz2) orelse  
                  matches_at_or_after (i + 1))  
211          in          in
212              matches_at_or_after 0          search
213          end          end
214    
215      fun compare (a, b) =      fun compare (a, b) =

Legend:
Removed from v.1154  
changed lines
  Added in v.1155

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