gl changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | happy new year, dudes.
buluca has joined #ocaml
whatthedeuce has quit ["Goodbye"]
bluestorm has quit ["Konversation terminated!"]
Axioplase has quit ["leaving"]
smimou has quit ["bli"]
jeberle has joined #ocaml
jeberle has quit [Read error: 104 (Connection reset by peer)]
b00t has quit [Read error: 104 (Connection reset by peer)]
joshcryer has joined #ocaml
jeberle has joined #ocaml
<jeberle>
set autostick_split_windows OFF
<jeberle>
sorry. new to irssi.
pants1 has joined #ocaml
jeberle has left #ocaml []
Z4rd0Z has quit []
<lmbdwr>
is it possible to do a match on 2 separate typed construct in a single match ? (say I have 2 input list and wants to extract their head simmultaneously for matching)
<hcarty>
lmbdwr: Could you use: match ([1;2;3],[2;4;5]) with (hd1::tl1,hd2::tl2) -> 1
<hcarty>
This seems to work properly, if it does what you want
<lmbdwr>
yep it works :)
<lmbdwr>
thats nice
bzzbzz has quit ["leaving"]
buluca has left #ocaml []
Mr_Awesome has joined #ocaml
Smerdyakov has quit ["Leaving"]
b00t has joined #ocaml
Z4rd0Z has joined #ocaml
piggybox has quit [Connection timed out]
shawn_ has joined #ocaml
jeberle has joined #ocaml
sponge45 has quit ["zzzzzzzzzz"]
jeberle has quit [Client Quit]
b00t has quit [Read error: 104 (Connection reset by peer)]
batdog is now known as batdog|gone
Mr_Awesome has quit ["...and the Awesome level drops"]
_velco has joined #ocaml
Z4rd0Z has quit []
b00t has joined #ocaml
smimp has joined #ocaml
triple_ has joined #ocaml
b00t has quit [Remote closed the connection]
pango is now known as pangoafk
triple__ has joined #ocaml
triple__ has quit ["leaving"]
triple_ has quit [Read error: 110 (Connection timed out)]
velco has joined #ocaml
khaladan has joined #ocaml
love-pingoo has joined #ocaml
Submarine has quit ["Leaving"]
jlouis has quit [Remote closed the connection]
pants1 has quit [Read error: 110 (Connection timed out)]
gim has joined #ocaml
ocher has quit [Read error: 104 (Connection reset by peer)]
ocher has joined #ocaml
ikaros has quit [Remote closed the connection]
ikaros has joined #ocaml
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good e]
Z4rd0Z has joined #ocaml
descender has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good e]
descender has joined #ocaml
Aradorn has joined #ocaml
batdog|gone is now known as batdog
joshcryer has quit [Connection timed out]
Foxyloxy has quit ["Sausages!"]
love-pingoo has quit ["Leaving"]
Smerdyakov has joined #ocaml
velco has quit ["Ex-Chat"]
Oyd1111_ has quit [Read error: 110 (Connection timed out)]
shawn_ has quit ["This computer has gone to sleep"]
_velco is now known as velco
slipstream has joined #ocaml
velco has quit [Read error: 60 (Operation timed out)]
smimou has joined #ocaml
slipstream-- has quit [Read error: 110 (Connection timed out)]
velco has joined #ocaml
love-pingoo has joined #ocaml
pangoafk is now known as pango
bluestorm has joined #ocaml
cmeme has quit [Connection reset by peer]
jlouis has joined #ocaml
cmeme has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
shawn_ has joined #ocaml
shawn_ has quit [Read error: 54 (Connection reset by peer)]
shawn_ has joined #ocaml
bluestorm is now known as bluestorm_aw
sponge45 has joined #ocaml
shawn_ has quit [Connection timed out]
shawn_ has joined #ocaml
Submarine has joined #ocaml
<hcarty>
I want to find a bigarray type based on a string (ex. "UINT8" -
<hcarty>
> int8_unsigned)
<hcarty>
However, trying to use a match str with ... gives me type errors
<hcarty>
How do you write an function to do something like this?
Aradorn has quit ["This computer has gone to sleep"]
<pango>
strings are not char arrays
<hcarty>
Sorry - I don't think I was clear with that
<hcarty>
The bigarray will have some manner of numeric data in it
<hcarty>
A string is returned from a C function, such as "UINT8" or "FLOAT32" that I want to use to generate a Genarray of the proper type
<hcarty>
match some_string with "UINT8" -> int8_unsigned | "FLOAT32" -> float32 | ... and so on
<pango>
that's not possible, all the value of the branches of a match much have the same type
Shimei has quit [Connection timed out]
<hcarty>
Do you know a method to get the same result? These can all be passed to Genarray.create, so I'm thinking that something should be able to be done here
<pango>
maybe using some variant type... or better yet, a functor
Shimei has joined #ocaml
<lmbdwr>
hcarty, try : type typeret = Cons of sometype | OtherCons of someothertype | ....
<lmbdwr>
for each type that you want to return
<lmbdwr>
thats a variant type, as said pango
<lmbdwr>
then you will be able to do what you are saying, because all branch of the match are typed by typeret
<hcarty>
pango and lmbdwr: Thank you both very mcuh
<hcarty>
much
<hcarty>
I'm still in the learning stages with OCaml so I appreciate the help
batdog is now known as batdog|gone
<pango>
the problem with that approach is that you'll have to check the constructor of your array value everytime you use it
<pango>
that's why a functor is a superior approach... write your code for generic array module signature, then instanciate it for each type of array
<pango>
you may still need variants outside of functorized code, though
jlouis has quit [Remote closed the connection]
Shimei has quit [Connection timed out]
Shimei has joined #ocaml
postalchris has joined #ocaml
bluestorm_aw has quit [Remote closed the connection]
beschmi has quit ["Leaving"]
bluestorm has joined #ocaml
smimou has quit [Remote closed the connection]
smimou has joined #ocaml
Aradorn has joined #ocaml
Aradorn has quit [Client Quit]
velco has quit ["I'm outta here ..."]
Z4rd0Z has quit []
<hcarty>
I had to run for a bit, but I think I made some progress. I'm still getting type errors though and I'm not sure how to make the new variant type into a Bigarray.kind
<hcarty>
http://0ok.org/test.ml is a short snippet of code which illustrates what I'm trying to do
<pango>
f foo returns a value of type tt, not some ('a, 'b) Bigarray.kind
<hcarty>
And I have to admit to being a little lost as to how to get ('a, 'b) Bigarray.kind out of this
<pango>
and the type of "a" cannot be statically determined either
<pango>
(with some "open Bigarray" missing at the beginning)
<hcarty>
Ah... ok, I think I follow. I'll try it with my other code.
jeberle has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
bluestorm has quit ["Konversation terminated!"]
<hcarty>
Is it possible to extract the "plain" Genarray.t from the tt value?
<pango>
thru pattern matching
<pango>
match a with | StringArray x -> (* x is a (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Genarray.t here *) | FloatArray y -> (* y is a (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Genarray.t here *)
<hcarty>
Ok, thank so much for your help
<pango>
np
smimou has quit ["bli"]
Z4rd0Z has joined #ocaml
postalchris has quit [Read error: 145 (Connection timed out)]