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/releases/release-110.61/Util/list-format-sig.sml
ViewVC logotype

View of /smlnj-lib/releases/release-110.61/Util/list-format-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2253 - (download) (annotate)
Thu Dec 14 18:21:10 2006 UTC (12 years, 7 months ago) by blume
File size: 1215 byte(s)
Release 110.61
(* list-format-sig.sml
 *
 * COPYRIGHT (c) 1993 by AT&T Bell Laboratories.  See COPYRIGHT file for details.
 *
 *)

signature LIST_FORMAT =
  sig

    val fmt : {
	    init : string,
	    sep : string,
	    final : string,
	    fmt : 'a -> string
	  } -> 'a list -> string
	(* given an initial string (init), a separator (sep), a terminating
	 * string (final), and an item formating function (fmt), return a list
	 * formatting function.  The list ``[a, b, ..., c]'' gets formated as
	 * ``init ^ (fmt a) ^ sep ^ (fmt b) ^ sep ^ ... ^ sep ^ (fmt c) ^ final.''
	 *)

    val listToString : ('a -> string) -> 'a list -> string
	(* formats a list in SML style (i.e., init="[", sep=",", final="]"). *)

    val scan : {
	    init : string,
	    sep : string,
	    final : string,
	    scan : (char, 'b) StringCvt.reader -> ('a, 'b) StringCvt.reader
	  } -> (char, 'b) StringCvt.reader -> ('a list, 'b) StringCvt.reader
	(* given an expected initial string, a separator, a terminating
	 * string, and an item scanning function, return a function that
	 * scans a string for a list of items.  Whitespace is ignored.
	 * If the input string has the incorrect syntax, then NONE is returned.
	 *)

  end; (* LIST_FORMAT *)

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