On Fri, 5 Jan 2007, al_kolesnikoff wrote:
> # let dbs = list_dbs db ();;
> val dbs : string array option = Some [|"mysql"; "radius"; "test"|]
>
> If I'm trying:
>
> # Array.length dbs;;
>
> I'm teceive: This expression has type string array option but is here
> used with type
> 'a array
>
> Yes, Array.length must be same type as "dbs", but how it can be done?
Your dbs object is not exactly an array, it is an option type: its value
is either "None" or "Some a" where "a" is an array.
If you want to get the length of the array, you should do something like:
match dbs with
None -> failwith "I cannot answer your question"
| Some a -> Array.length a
Martin
--
Martin Jambon
http://martin.jambon.free.fr
.