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 /tests/trunk/bugs/tests.obsolete/bug1549.1.sml
ViewVC logotype

View of /tests/trunk/bugs/tests.obsolete/bug1549.1.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2460 - (download) (annotate)
Sat Apr 28 20:18:10 2007 UTC (12 years, 2 months ago) by gkuan
File size: 1019 byte(s)
(* bug1549.1.sml *)

signature NUMBER =
sig
  type t
end;

signature VEC =
sig
  structure Number : NUMBER
  type t
  val fromSeq : Number.t Vector.vector -> t
  val toSeq   : t -> Number.t Vector.vector
end;

functor PointFromVector(structure Vec : VEC) =
struct
  structure Vec = Vec
end;

signature GEOMETRY_PRIMS =
sig
  structure Point : sig
		      structure Vec : VEC
		    end
end;

functor GeometryPrims2d (structure Number : NUMBER)
    : GEOMETRY_PRIMS =
struct
  structure Vec =
  struct
    structure Number = Number
    type t = Number.t * Number.t
    fun fromSeq #[x, y] : t = (x, y)
    fun toSeq (x,y) = #[x, y]
  end

  structure Point = PointFromVector(structure Vec = Vec)
end;

structure RealNumber =
struct
  type t = real
end;

structure RealGeometryPrims2d = GeometryPrims2d(structure Number = RealNumber);

local
  (* #[6.0,0.0] avoids errors *)
  val vs = RealGeometryPrims2d.Point.Vec.toSeq (6.0, 0.0)
in
  val foo = Array.tabulate (Vector.length vs,
			    fn i => Vector.sub (vs, i))
end;

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