Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/benchmarks/todo/vboyer/vector-util.sml
ViewVC logotype

View of /sml/trunk/benchmarks/todo/vboyer/vector-util.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 193 - (download) (annotate)
Fri Nov 20 17:43:59 1998 UTC (23 years ago) by monnier
File size: 473 byte(s)
Initial revision
structure VectorUtil =
  struct
    local
      open Vector
    in
    fun listOfVector v = let
	  fun f (0, l) = l
	    | f (i, l) = f (i-1, Vector.sub(v, i-1) :: l)
	  in
	    f (Vector.length v, [])
	  end
    fun mapv f = let
	  fun mapv' #[a] = #[f a]
	    | mapv' #[a, b] = #[f a, f b]
	    | mapv' #[a, b, c] = #[f a, f b, f c]
	    | mapv' #[a, b, c, d] = #[f a, f b, f c, f d]
	    | mapv' v = vector (map f (listOfVector v))
	  in
	    mapv'
	  end
    end
 end;

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