On 26/04/12 17:06, Jeremy Singer wrote:
* printf without lots of String.concat
Quick answer to this one: instead of
print (String.concat strs)
do
List.app print strs
Here the text is just kept as a list of strings but, in general, one can
build up any abstract text representation to suit a particular need.
For example, I use the following interface for horizontal text:
signature H_TEXT_TREE =
sig
type t
(* Constructors *)
val empty : t
val sp : int -> t
val str : string -> t
val chr : char -> t
val seq : t list -> t
(* Derived constructors *)
val concat : string list -> t
(* Predicates *)
val isEmpty : t -> bool
(* Operations *)
val size : t -> int
val app : (string -> unit) -> t -> unit
val toStrings : t -> string list
end
Phil
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml