List Info

Thread: Re: "ocaml_beginners"::[] Turning a file into a space-delimited stream?




Re: "ocaml_beginners"::[] Turning a file into a space-delimited stream?
user name
2007-01-26 19:58:17

On Fri, 26 Jan 2007, Mac Mason wrote:

> I've got a file that has many, many whitespace-delimited integers (and
>; one whitespace-delimited string, as the very first element).
>
> I'm looking for a clean way to read them in one at a time; what I'd
> really like is a stream (or an Enum, I suppose) that's constructed
> from these values. I can put this together as a combination of
> Std.input_all, Str.split, and so on, but it's really awful and I don't
> know much about the tail-recursive properties of those functions (like
> I said: many, many integers). It seems like I should be able to
> (ab)use the stream syntax or module to do this for me.
>
> Thoughts?

Scanf.fscanf, maybe?

http://caml.inria.fr/pub/docs/manual-ocaml/libref/Scanf.html

Dave

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )