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 /smlnj-lib/trunk/SExp/test-pp.sml
ViewVC logotype

View of /smlnj-lib/trunk/SExp/test-pp.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4685 - (download) (annotate)
Mon Aug 20 16:45:33 2018 UTC (9 months ago) by jhr
File size: 833 byte(s)
  Added SExp pretty printer, plus a bug fix
(* test-pp.sml
 *
 * COPYRIGHT (c) 2018 The Fellowship of SML/NJ (http://www.smlnj.org)
 * All rights reserved.
 *
 * Test the pretty printing of S-Expressions.
 *)

structure TestPP =
  struct

    local
      structure S = SExp
      structure PP = TextIOPP

      fun pr wid sexp = let
	    val ppStrm = PP.openOut{dst = TextIO.stdOut, wid=wid}
	    in
	      SExpPP.output (ppStrm, sexp);
	      PP.closeStream ppStrm
	    end

      fun list items = S.LIST(S.SYMBOL(Atom.atom "list") :: items)
    in
  (* a large list *)
    fun prList wid = pr wid (list (List.tabulate(100, fn i => S.INT(IntInf.fromInt i))))
  (*  list of lists *)
    fun prListOfLists wid = let
	  fun mkList n = list (List.tabulate(n, fn i => S.INT(IntInf.fromInt i)))
	  in
	    pr wid (list (List.tabulate(50, mkList)))
	  end
    end (* local *)

  end

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