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/vector.sml
ViewVC logotype

Diff of /sml/trunk/system/Basis/Implementation/vector.sml

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

revision 3416, Thu Jul 9 16:14:26 2009 UTC revision 3417, Thu Jul 9 16:19:33 2009 UTC
# Line 1  Line 1 
1  (* vector.sml  (* vector.sml
2   *   *
3   * COPYRIGHT (c) 1994 AT&T Bell Laboratories.   * COPYRIGHT (c) 2009 The Fellowship of SML/NJ (http://www.smlnj.org)
4   *   * All rights reserved.
5   *)   *)
6    
7  structure Vector : VECTOR =  structure Vector : VECTOR =
# Line 27  Line 27 
27      fun checkLen n =      fun checkLen n =
28          if InlineT.DfltInt.ltu(maxLen, n) then raise General.Size else ()          if InlineT.DfltInt.ltu(maxLen, n) then raise General.Size else ()
29    
30      fun fromList l = let    (* this function is implemented in base/system/smlnj/init/pervasive.sml *)
31          (* no list can be longer than what is representable as int: *)      val fromList = vector
           fun len ([], n) = n  
             | len ([_], n) = n ++ 1  
             | len (_::_::r, n) = len (r, n ++ 2)  
           val n = len (l, 0)  
     in  
         checkLen n;  
         if n = 0 then Assembly.vector0  
         else Assembly.A.create_v (n, l)  
     end  
32    
33      fun tabulate (0, _) = Assembly.vector0      fun tabulate (0, _) = Assembly.vector0
34        | tabulate (n, f) = let        | tabulate (n, f) = let

Legend:
Removed from v.3416  
changed lines
  Added in v.3417

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