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 /smlnj-lib/trunk/Util/dynamic-array.sml
ViewVC logotype

Diff of /smlnj-lib/trunk/Util/dynamic-array.sml

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

revision 3336, Wed May 13 12:46:49 2009 UTC revision 3337, Wed May 13 13:17:00 2009 UTC
# Line 1  Line 1 
1  (* dynamic-array.sml  (* dynamic-array.sml
2   *   *
3   * COPYRIGHT (c) 1999 Bell Labs, Lucent Technologies.   * COPYRIGHT (c) 2009 The Fellowship of SML/NJ (http://www.smlnj.org)
4     * All rights reserved.
5   *   *
6   * Polymorhic arrays of unbounded length   * Polymorhic arrays of unbounded length
  *  
7   *)   *)
8    
9  structure DynamicArray :> DYNAMIC_ARRAY =  structure DynamicArray :> DYNAMIC_ARRAY =
# Line 93  Line 93 
93              else fillDflt(bnd,newbnd)              else fillDflt(bnd,newbnd)
94            end            end
95    
96      (* get the array slice that covers the defined portion of the array *)
97        fun slice (BLOCK(arr, _, bnd)) =
98              ArraySlice.slice(!arr, 0, SOME(!bnd))
99    
100      (* we implement the iterators by using the array slice operations *)
101        fun vector arr = ArraySlice.vector (slice arr)
102        fun appi f arr = ArraySlice.appi f (slice arr)
103        fun app f arr = ArraySlice.app f (slice arr)
104        fun modifyi f arr = ArraySlice.modifyi f (slice arr)
105        fun modify f arr = ArraySlice.modify f (slice arr)
106        fun foldli f init arr = ArraySlice.foldli f init (slice arr)
107        fun foldri f init arr = ArraySlice.foldri f init (slice arr)
108        fun foldl f init arr = ArraySlice.foldl f init (slice arr)
109        fun foldr f init arr = ArraySlice.foldr f init (slice arr)
110        fun findi pred arr = ArraySlice.findi pred (slice arr)
111        fun find pred arr = ArraySlice.find pred (slice arr)
112        fun exists pred arr = ArraySlice.exists pred (slice arr)
113        fun all pred arr = ArraySlice.all pred (slice arr)
114        fun collate cmp (arr1, arr2) = ArraySlice.collate cmp (slice arr1, slice arr2)
115    
116    (* TODO
117        val copy : {di:int, dst:'a array, src:'a array} -> unit
118        val copyVec : {di:int, dst:'a array, src:'a vector} -> unit
119    *)
120    
121    end (* DynamicArrayFn *)    end (* DynamicArrayFn *)
122    

Legend:
Removed from v.3336  
changed lines
  Added in v.3337

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