English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
[Caml-list] about Obj.magic
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe TROESTLER <Christophe.Troestler@u...>
Subject: Re: [Caml-list] about Obj.magic
On Fri, 31 May 2002, Olivier Andrieu <oandrieu@nerim.net> wrote:
> 
>  Christophe TROESTLER [Friday 31 May 2002] :
>  > Is there any safe way to check whether a "kind : ('a, 'b)
>  > Bigarray.kind" parameter is "float64", "complex64",... or are we bound
>  > to do
>  >   kind  = (Obj.magic float64 : ('a, 'b) Bigarray.kind)
> 
> I'm not sure if that's what you mean but in the CVS version, there are
> new functions like Genarray.kind :
>   external kind: ('a, 'b, 'c) t -> ('a, 'b) kind = "bigarray_kind"

I mean e.g.,

let create kind =
  if kind  = (Obj.magic float64 : ('a, 'b) Bigarray.kind) then
    ... fun a -> ... something ...
  else
    ... fun a -> ... something else ...

where you have to imagine [a] as being a bigarray of kind [kind].

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