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
Writing a list to 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-14 (05:10)
From: Johann Spies <jspies@s...>
Subject: Writing a list to a file
How do I get rid of the warning in the following function:
-------------------------------
# let skryflys l lys =
List.map (Printf.fprintf l "%s\n") lys;
close_out l;;
Toplevel input:
# let skryflys l lys =
List.map (Printf.fprintf l "%s\n") lys;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
close_out l;;
Warning: this expression should have type unit.
val skryflys : out_channel -> string list -> unit = <fun>


---------------------------------

Or in other words, how can I change the List.map-part to have a type
unit?

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

"Yea, though I walk through the valley of the shadow of
death, I will fear no evil, for thou art with me; 
thy rod and thy staff they comfort me." Psalms 23:4