Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] Arrays and boxed/unboxed data

1 view
Skip to first unread message

Erik de Castro Lopo

unread,
Jul 6, 2006, 3:25:53 AM7/6/06
to caml...@inria.fr
Hi all,

I'm about to start some work on an algorithm which will need a
quite large 2-D array of Ocaml ints.

I assume that Arrays of ints will be unboxed. Is that correct?

What about other types? For instance:

type my_enum = A | B | C

If I made an array of my_enum would that be unboxed?

Is there any general rule that will tell me what is boxed and
what is unboxed? If I define an Array of some data type is
there a way of figuring this out?

TIA,
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo
+-----------------------------------------------------------+
"I want to make sure (a user) can't get through ... an online
experience without hitting a Microsoft ad."
- Microsoft CEO, Steve Ballmer on the Microsoft search engine.

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Eric Cooper

unread,
Jul 6, 2006, 10:04:19 AM7/6/06
to caml...@inria.fr
On Thu, Jul 06, 2006 at 10:27:21AM +1000, Erik de Castro Lopo wrote:
> Is there any general rule that will tell me what is boxed and
> what is unboxed?

Section 18.3 of the manual.

--
Eric Cooper e c c @ c m u . e d u

Jon Harrop

unread,
Jul 9, 2006, 10:02:29 AM7/9/06
to caml...@yquem.inria.fr
On Saturday 08 July 2006 16:25, Tom wrote:
> You could probably use one dimensional array and use a modified getter and
> setter functions that would transform 2-D indeces into 1-D indeeces. In
> this way, all the elements would be unboxed.

Although you're likely to hit the max array length limit on 32-bit.

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

0 new messages