Functional syntax (Was: RE: [mercury-users] Hi, and determinism)
Fergus Henderson
fjh at cs.mu.OZ.AU
Sun Feb 4 00:06:52 AEDT 2001
On 02-Feb-2001, Robert Bossy <bossy at ccr.jussieu.fr> wrote:
> Fergus Henderson a écrit :
> >
> > On 31-Jan-2001, Mattias Waldau <mattias.waldau at abc.se> wrote:
> > > The beatty of Ocaml is that it can do anything a low-level language like C
> > > can - and almost as fast - and that you can make pure programs.
> >
> > Does Ocaml have support for bit fields, or something equivalent?
>
> Yes, look for the bitv library that can be found at:
> http://www.lri.fr/~filliatr/ftp/ocaml/ds/
> (files are bitv.ml bitv.mli bitv.ps.gz)
That's not the same. A bit vector ADT is a useful thing, but it doesn't
help with the kinds of things for which you'd use bit fields in C.
Bit fields are handy for when you have a data type with several fields
that are each less than one word in size, which you want to optimize
for space rather than speed, by packing multiple fields into a single
word. In ML and Mercury you can achieve that by using integer fields
and manually writing access routines that get and set particular
groups of bits within a word. But in C you can use bit fields, which
means you don't have to write the bit twiddling access routines.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list