> Is there a better way in Ocaml to read a file line by line than via the
> read_line function?
You might want to use the ExtLib for this.
You can look at the CVS here :
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ocaml-lib/
The code you need :
-------------------------------
open ExtLib
let e = input_enum my_file in
let e = Enum.map my_conversion_function e in
List.of_enum e (* will return you the mapped list without any rev done *)
-------------------------------------
(You'll need the ExtList and the Enum modules for it)
> Does one
> know whether there exists a function in OCaml which converts a String to
> a character-list? I use this construct in Clean then in order to extract
> floating point numbers from that character list: ['1','.','2',...] and
> store this floating point numbers via pattern matching in my result-list.
you can use ExtString.enum to get a char Enumeration on your string.
It is more efficient then to use it as an Enum, since you don't create any
data structure to store the chars , but you still can get a list from it by
doing List.of_enum.
Nicolas Cannasse
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners