* [Caml-list] Array.make
@ 2001-12-29 22:18 Ian Zimmerman
2001-12-30 12:58 ` David Mentré
2002-01-04 13:35 ` Xavier Leroy
0 siblings, 2 replies; 3+ messages in thread
From: Ian Zimmerman @ 2001-12-29 22:18 UTC (permalink / raw)
To: OCAML
According to the documentation (in 3.01 at least),
Array.make n a
raises an exception when n = 0. Why? It looks like an unnecessary
special case. The damned hysterical raisins again?
BTW, the documentation also doesn't say how Array.init behaves in this
respect.
--
Ian Zimmerman, Oakland, California, U.S.A.
GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087
In his own soul a man bears the source
from which he draws all his sorrows and his joys.
Sophocles.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Array.make
2001-12-29 22:18 [Caml-list] Array.make Ian Zimmerman
@ 2001-12-30 12:58 ` David Mentré
2002-01-04 13:35 ` Xavier Leroy
1 sibling, 0 replies; 3+ messages in thread
From: David Mentré @ 2001-12-30 12:58 UTC (permalink / raw)
To: Ian Zimmerman; +Cc: OCAML
Ian Zimmerman <itz@speakeasy.org> writes:
> raises an exception when n = 0. Why? It looks like an unnecessary
> special case. The damned hysterical raisins again?
Was a bug in the doc. Fixed in latest release (3.04):
val make : int -> 'a -> 'a array
[...]
Raise Invalid_argument if n < 0 or n > Sys.max_array_length.
> BTW, the documentation also doesn't say how Array.init behaves in this
> respect.
Same behavior as Array.make (ok, maybe it should be in the doc). BTW, it
seems that check is made using same code as Array.make (haven't look at
the code):
# Array.init 0 (fun x -> 0) ;;
- : int array = [||]
# Array.init (-1) (fun x -> 0) ;;
Exception: Invalid_argument "Array.make".
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Array.make
2001-12-29 22:18 [Caml-list] Array.make Ian Zimmerman
2001-12-30 12:58 ` David Mentré
@ 2002-01-04 13:35 ` Xavier Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 2002-01-04 13:35 UTC (permalink / raw)
To: Ian Zimmerman; +Cc: OCAML
> According to the documentation (in 3.01 at least),
>
> Array.make n a
>
> raises an exception when n = 0. Why? It looks like an unnecessary
> special case. The damned hysterical raisins again?
That was a documentation error, which was fixed in 3.02. The case n = 0
works fine and returns a zero-sized array as expected.
> BTW, the documentation also doesn't say how Array.init behaves in this
> respect.
Like Array.make, but you're correct that this should be written
explicitly in the doc.
- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-01-04 13:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-29 22:18 [Caml-list] Array.make Ian Zimmerman
2001-12-30 12:58 ` David Mentré
2002-01-04 13:35 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox