Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Really confused - repost
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Matt Gushee <mgushee@h...>
Subject: Re: [Caml-list] Really confused - repost
On Thu, Apr 03, 2003 at 07:57:08PM -0500, Ryan Bastic wrote:
> 
>   it should be fairly clear what i'm trying to do... i want to split up
> the vector
> of student names into varying-sized groups, preferably using arrays of
> arrays, but any other data structure will do :-) 
> 
> if you try executing students.ml, you'll see on line 68 there is a
> problem...
> 
> can anyone point me in the direction as to what's going on??

Sure. What you are doing here

    !groups.(!q) := ar;

is trying to assign an array ref as the *value* of a ref. In other
words, you're trying to replace something like:

    [|"Phred","Sue"|]

with

    { contents = [|"Karla","Hans"|] }

which is obviously a different type ( string array ref instead of string
array). I think what you want to do is
    
    !groups.(!q) <- ar;

The revised version is replacing an array element (which is a ref) with
a new ref.

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
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