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/Basis/Implementation/word8-array-slice.sml
ViewVC logotype

Diff of /sml/branches/idlbasis-devel/src/system/Basis/Implementation/word8-array-slice.sml

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

revision 850, Mon Jun 25 19:42:31 2001 UTC revision 859, Wed Jun 27 21:43:12 2001 UTC
# Line 151  Line 151 
151  (* val getItem : slice -> (elem * slice) option *)  (* val getItem : slice -> (elem * slice) option *)
152    fun getItem (SL{base,start,stop}) =    fun getItem (SL{base,start,stop}) =
153        if stop<=start then NONE        if stop<=start then NONE
154        else SOME(sub'(base, j'), SL{base,start+1,stop})        else SOME(sub'(base, j'), SL{base=base,start=start+1,stop=stop})
   
   end  
155    
156  (* val appi : (int * elem -> unit) -> slice -> unit *)  (* val appi : (int * elem -> unit) -> slice -> unit *)
157    fun appi f (SL{base,start,stop}) =    fun appi f (SL{base,start,stop}) =
# Line 164  Line 162 
162        end        end
163    
164  (* val app  : (elem -> unit) -> slice -> unit *)  (* val app  : (elem -> unit) -> slice -> unit *)
165    fun appi f (SL{base,start,stop} =    fun appi f (SL{base,start,stop}) =
166        let fun app i = if (i < stop)        let fun app i = if (i < stop)
167                then (f (sub'(base, i)); app(i+1))                then (f (sub'(base, i)); app(i+1))
168                else ()                else ()
# Line 172  Line 170 
170        end        end
171    
172  (* val mapi : (int * elem -> 'b) -> slice -> vector *)  (* val mapi : (int * elem -> 'b) -> slice -> vector *)
173    fun mapi f (SL{base,start,stop} =    fun mapi f (SL{base,start,stop}) =
174        let val len = stop - start        let val len = stop - start
175            fun mapf (i, l) = if (i < stop)            fun mapf (i, l) = if (i < stop)
176                  then mapf (i+1, f (i, sub'(base, i)) :: l)                  then mapf (i+1, f (i, sub'(base, i)) :: l)
# Line 183  Line 181 
181        end        end
182    
183  (* val map  : (elem -> 'b) -> slice -> vector *)  (* val map  : (elem -> 'b) -> slice -> vector *)
184    fun map f (SL{base,start,stop} =    fun map f (SL{base,start,stop}) =
185        let val len = stop - start        let val len = stop - start
186            fun mapf (i, l) = if (i < stop)            fun mapf (i, l) = if (i < stop)
187                  then mapf (i+1, f (sub'(base, i)) :: l)                  then mapf (i+1, f (sub'(base, i)) :: l)
# Line 279  Line 277 
277        let fun cmp (i,i') =        let fun cmp (i,i') =
278                if (i < stop)                if (i < stop)
279                then if (i' >= stop') then GREATER                then if (i' >= stop') then GREATER
280                     else case comp(sub'(base, i)),                     else case comp(sub'(base, i),
281                                    sub'(base', i'))                                    sub'(base', i'))
282                            of EQUAL => cmp(i+1,i'+1)                            of EQUAL => cmp(i+1,i'+1)
283                             | x => x                             | x => x
# Line 288  Line 286 
286         in cmp(start,start')         in cmp(start,start')
287        end        end
288    
 end (* structure Word8VectorSlice *)  
289  end (* structure Word8ArraySlice *)  end (* structure Word8ArraySlice *)

Legend:
Removed from v.850  
changed lines
  Added in v.859

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