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/programs/logic/makestring.sml
ViewVC logotype

View of /sml/trunk/benchmarks/programs/logic/makestring.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 193 - (download) (annotate)
Fri Nov 20 17:43:59 1998 UTC (21 years, 7 months ago) by monnier
File size: 853 byte(s)
Initial revision
(* makestring.sml *)

structure Makestring =
struct
  local
    open Term Name
  in
	fun makestring (STR(f,nil)) = f
	  | makestring (STR(f,ts)) = f ^ "(" ^ makestring_s ts ^ ")"
	  | makestring (REF(r)) = 
	    (case !r of 
		 SOME t => makestring t
	       | _ => name_of_var r)
	  | makestring (CON(f)) = f
	  | makestring (INT(i)) = Int.toString i
	and makestring_s nil = raise BadArg "makestring_s" (* can't happen *)
	  | makestring_s (t::nil) = makestring t
	  | makestring_s (t::ts) = makestring t ^ "," ^ makestring_s ts

	(* print substitution, represented as list of variable/term pairs *)
	fun makestrings l =
	    let
		fun ms [] = ".\n"
		  | ms ((s, t) :: rest) =
		    "\n" ^ s ^ " = " ^ (makestring t) ^ (ms rest)
	    in
		variable_names := l;
		next_made_up_variable_num := 0;
		ms l
	    end
  end (* local *)
end; (* Makestring *)


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