|
List Info
Thread: "ocaml_beginners"::[] Bigarray.Array1.map_file - can't automatically allocate array
|
|
| "ocaml_beginners"::[]
Bigarray.Array1.map_file - can't
automatically allocate array |

|
2006-08-11 19:04:54 |
Can't seem to get to grips with Bigarray.Array1.map_file,
and I can't
find any examples online. I'm trying to pass in -1 for the
filesize
(which, according to the docs, is supposed to automatically
allocate
an array equal to the size of the file) but it fails in the
compile
stage with
$ cat dawgutils.ml
open Bigarray
open Printf
let dawg =
let fd = Unix.openfile "sowpods.dwg" [
Unix.O_RDONLY ] 0 in
Array1.map_file fd int32 c_layout false -1;;
$ ocaml unix.cma bigarray.cma dawgutils.ml
File "dawgutils.ml", line 6, characters 2-41:
This expression has type
int -> (int32, Bigarray.int32_elt, Bigarray.c_layout)
Bigarray.Array1.t
but is here used with type int
martin
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[]
Bigarray.Array1.map_file - can't
automatically allocate array |

|
2006-08-11 19:15:59 |
On Sat, 12 Aug 2006, "Martin DeMello"
<martindemello gmail.com> wrote:
>
> let dawg =
> let fd = Unix.openfile "sowpods.dwg" [
Unix.O_RDONLY ] 0 in
> Array1.map_file fd int32 c_layout false -1;;
Try this:
Array1.map_file fd int32 c_layout false (-1)
(otherise "-" is taken as a binary operator).
ChriS
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[]
Bigarray.Array1.map_file - can't
automatically allocate array |

|
2006-08-11 19:15:34 |
On Aug 11, 2006, at 1:04 PM, Martin DeMello wrote:
> let dawg =
> let fd = Unix.openfile "sowpods.dwg" [
Unix.O_RDONLY ] 0 in
> Array1.map_file fd int32 c_layout false -1;;
>
> $ ocaml unix.cma bigarray.cma dawgutils.ml
> File "dawgutils.ml", line 6, characters
2-41:
> This expression has type
> int -> (int32, Bigarray.int32_elt,
Bigarray.c_layout)
> Bigarray.Array1.t
> but is here used with type int
It looks like the compiler might be parsing that as:
(Array1.map_file fd int32 c_layout false) - 1;;
Changing -1 to ~-1 using the explicit unary negative works
fine.
William D. Neumann
"I eat T-bone steaks, I lift barbell plates, I'm
sweeter than a
German chocolate cake. I'm the reflection of perfection,
the number
one selection. I'm the man of the hour, the man with the
power, too
sweet to be sour. The ladies' pet, the men's regret, where
what you
see is what you get, and what you don't see, is better
yet."
--Superstar Billy Graham
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[]
Bigarray.Array1.map_file - can't
automatically allocate array |

|
2006-08-11 19:21:45 |
On 8/12/06, William Neumann <wneumann cs.unm.edu> wrote:
> On Aug 11, 2006, at 1:04 PM, Martin DeMello wrote:
>
> > let dawg =
> > let fd = Unix.openfile "sowpods.dwg"
[ Unix.O_RDONLY ] 0 in
> > Array1.map_file fd int32 c_layout false -1;;
> >
> > $ ocaml unix.cma bigarray.cma dawgutils.ml
> > File "dawgutils.ml", line 6,
characters 2-41:
> > This expression has type
> > int -> (int32, Bigarray.int32_elt,
Bigarray.c_layout)
> > Bigarray.Array1.t
> > but is here used with type int
>
> It looks like the compiler might be parsing that as:
> (Array1.map_file fd int32 c_layout false) - 1;;
>
> Changing -1 to ~-1 using the explicit unary negative
works fine.
Ohhh!! I spent over an hour trying to figure out the error
message
Thanks to both of you!
martin
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
[1-4]
|
|