Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

Browse thread
reading a file
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-15 (03:43)
From: Johann Spies <jspies@s...>
Subject: Assert. (was "ocaml_beginners"::[] reading a file)
On Fri, Apr 05, 2002 at 05:35:39PM +0200, Gerd Stolpmann wrote:

> I think this the point where it might be better to consider a fully
> imperative version:
> 
> let read_lines ch =
> let lines = ref [] in
> try
> while true do
> lines := input_line ch :: !lines
> done;
> assert false
> with
> End_of_file ->
> List.rev !lines

Why the "assert false". I don't find a lot of explaination of assert
in either the Ocaml documentation or the Ocaml Book.

Regards.

Johann

-- 
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

"Let not your heart be troubled: ye believe in God, 
believe also in me." John 14:1