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/system/Basis/Implementation/char-array.sml
 [smlnj] / sml / trunk / system / Basis / Implementation / char-array.sml

# Diff of /sml/trunk/system/Basis/Implementation/char-array.sml

revision 2162, Thu Nov 2 21:20:47 2006 UTC revision 4092, Fri Aug 14 11:43:56 2015 UTC
# Line 1  Line 1
1  (* char-array.sml  (* char-array.sml
2   *   *
3   * COPYRIGHT (c) 1994 AT&T Bell Labs.   * COPYRIGHT (c) 2015 The Fellowship of SML/NJ (http://www.smlnj.org)
5   *)   *)
6
7  structure CharArray : MONO_ARRAY =  structure CharArray : MONO_ARRAY_2015 =
8    struct    struct
9      structure String = StringImp      structure String = StringImp
10      structure A = InlineT.CharArray      structure A = InlineT.CharArray
# Line 221  Line 221
221      in      in
222          coll 0          coll 0
223      end      end
224
225      (* added for Basis Library proposal 2015-003 *)
226        fun toList arr = foldr op :: [] arr
227
228        fun fromVector v = let
229              val n = vlength v
230              in
231                if (n = 0)
232                  then A.newArray0()
233                  else let
234                    val arr = A.create n
235                    fun fill i = if (i < n)
236                          then (uupd(arr, i, vusub(v, i)); fill(i ++ 1))
237                          else arr
238                    in
239                      fill 0
240                    end
241              end
242
243        val toVector = vector
244
245    end (* CharArray *)    end (* CharArray *)

Legend:
 Removed from v.2162 changed lines Added in v.4092