<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/10/110a7ca80c34650ebf799695785ff6f5"
  from="Michal Moskal &lt;malekith@p...&gt;"
  author="Michal Moskal"
  date="2003-10-02T07:00:17"
  subject="Re: [Caml-list] beginner needs help creating a dynamically resizable array"
  prev="2003/10/19fb72de40775f093b3e192e9e0debc3"
  next="2003/10/72fbe552f5ee4e817ec1e4c3928c7888"
  prev-in-thread="2003/10/19fb72de40775f093b3e192e9e0debc3"
  next-in-thread="2003/10/72fbe552f5ee4e817ec1e4c3928c7888"
  prev-thread="2003/10/76aa3bb06f8f74f7369f6316670fddd9"
  next-thread="2003/10/261f050dccf87201bc913df1d656bf10"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] beginner needs help creating a dynamically resizable array">
<msg 
  url="2003/10/19fb72de40775f093b3e192e9e0debc3"
  from="Ram Bhamidipaty &lt;ramb@s...&gt;"
  author="Ram Bhamidipaty"
  date="2003-10-02T06:09:49"
  subject="[Caml-list] beginner needs help creating a dynamically resizable array">
<msg 
  url="2003/10/110a7ca80c34650ebf799695785ff6f5"
  from="Michal Moskal &lt;malekith@p...&gt;"
  author="Michal Moskal"
  date="2003-10-02T07:00:17"
  subject="Re: [Caml-list] beginner needs help creating a dynamically resizable array">
</msg>
<msg 
  url="2003/10/72fbe552f5ee4e817ec1e4c3928c7888"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-10-02T07:27:00"
  subject="Re: [Caml-list] beginner needs help creating a dynamically resizable array">
</msg>
<msg 
  url="2003/10/c9b4be8b6e07171d23f3098359d1a498"
  from="Markus Mottl &lt;markus@o...&gt;"
  author="Markus Mottl"
  date="2003-10-02T09:58:12"
  subject="Re: [Caml-list] beginner needs help creating a dynamically resizable array">
</msg>
</msg>
</thread>

<contents>
On Wed, Oct 01, 2003 at 10:59:18PM -0700, Ram Bhamidipaty wrote:
&gt; I am trying to create a dynamically resizable array. 
[...]
&gt; let resize dyn_array_ref new_size =
[...]
&gt; The problem I am running into is that I don't know how to create a new
&gt; larger array of the same time as the original array. The only two
&gt; choices that I can think of are: 1. Somehow store the type of the
&gt; array in the record or 2. Somehow get the array element type from the
&gt; "buf" array in the record.
&gt; 
&gt; Unfortunately I have no idea about how to do either 1 or 2.

You can fill your array with *value* buf.{0}. You don't need its
type. This will present some odds for the GC, but if it's for educational
purposes then it's OK. The other way is Obj.magic trickery...

&gt; I know there is atleast one package/module that provides this
&gt; functionality. But I don't want to use someone elses code - I am
&gt; trying to learn OCaml and I think this would be a good thing to do
&gt; with my own code.

...and for this reason I personally don't think it's best example to
learn OCaml on.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}&gt;+++ h

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

