Version française
Home     About     Download     Resources     Contact us    
Browse thread
reading/writing binary data
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] reading/writing binary data
On Tuesday 21 November 2006 13:56, Dmitry Bely wrote:
> let output_binary_int_little_endian ch n =
>   output_byte ch (n land 0xff);
>   output_byte ch ((n lsr 8) land 0xff);
>   output_byte ch ((n lsr 16) land 0xff);
>   output_byte ch ((n lsr 24) land 0xff)

I want to see those HOFs:

  let output_binary_int_little_endian ch n =
    List.iter (fun i -> output_byte ch ((n lsr i) land 0xff)) [0; 8; 16; 24];;

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists