<lewis1711>
hmmm, my attempts at doing computer algebra are coming along quite a bit better with ocaml than they did in scheme. pattern matching is a very powerful technique
emmanuelux has quit [Ping timeout: 240 seconds]
lewis1711 has quit [Remote host closed the connection]
myu2 has quit [Remote host closed the connection]
smerz has quit [Quit: Ex-Chat]
oriba has quit [Remote host closed the connection]
raichoo1 has joined #ocaml
raichoo1 has quit [Client Quit]
boscop_ has joined #ocaml
raichoo has quit [Ping timeout: 240 seconds]
boscop has quit [Ping timeout: 240 seconds]
Amorphous has quit [Ping timeout: 272 seconds]
Amorphous has joined #ocaml
somnium has quit [Remote host closed the connection]
lewis1711 has joined #ocaml
<lewis1711>
if I wanted to do pattern matching with strings, er, should I just a regex library or something?
<EliasAmaral>
(this is for ocamlopt, with ocamlc it was about ~6fps)
<EliasAmaral>
i'm trying disabling lightining etc but this doesn't help much
alexyk has joined #ocaml
Modius has joined #ocaml
myu2 has quit [Remote host closed the connection]
alexyk has quit [Read error: Connection reset by peer]
Fullma has quit [Quit: Fullma]
alexyk has joined #ocaml
almaisan-away is now known as al-maisan
wormphlegm has quit [Ping timeout: 240 seconds]
opla2 has quit [Ping timeout: 240 seconds]
alexyk has quit [Read error: Connection reset by peer]
opla2 has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
ftrvxmtrx has quit [Ping timeout: 260 seconds]
ftrvxmtrx has joined #ocaml
ulfdoz has quit [Ping timeout: 265 seconds]
ulfdoz has joined #ocaml
al-maisan is now known as almaisan-away
ftrvxmtrx has quit [Quit: Leaving]
_andre has joined #ocaml
tictactoc has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
opla2 has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
zhengli has joined #ocaml
init1 has joined #ocaml
<adrien>
EliasAmaral: if it's using opengl, it might well be the fault of your card, but how is cpu usage?
Snark has joined #ocaml
avsm has quit [Quit: Leaving.]
lewis1711 has left #ocaml []
asmanur has joined #ocaml
myu2 has joined #ocaml
jm_ocaml has joined #ocaml
asmanur_ has quit [Ping timeout: 260 seconds]
EliasAmaral has quit [Ping timeout: 260 seconds]
EliasAmaral has joined #ocaml
Snark has quit [Ping timeout: 260 seconds]
Snark has joined #ocaml
yezariaely has joined #ocaml
<EliasAmaral>
<adrien> EliasAmaral: if it's using opengl, it might well be the fault of your card, but how is cpu usage? > cpu usage is about 100%
<EliasAmaral>
(not ocaml-related, unless I can do it with maybe some ocaml library?), I sense that some programs, such as some emulators, has two modes: opengl, that is good-looking but slow here; and software renderer, that renders poorly but runs well. how can I write a program with such properties? (can I specify that opengl will be drawn with software renderer?)
EliasAmaral has quit [Ping timeout: 240 seconds]
avsm has joined #ocaml
asmanur has quit [*.net *.split]
dskippy1 has quit [*.net *.split]
rwmjones has quit [*.net *.split]
rixed_ has quit [*.net *.split]
mnabil has quit [*.net *.split]
orbitz has quit [*.net *.split]
pheredhel has quit [*.net *.split]
fremo__ has quit [*.net *.split]
rks has quit [*.net *.split]
mnabil has joined #ocaml
EliasAmaral has joined #ocaml
asmanur has joined #ocaml
dskippy1 has joined #ocaml
rwmjones has joined #ocaml
rixed_ has joined #ocaml
orbitz has joined #ocaml
pheredhel has joined #ocaml
fremo__ has joined #ocaml
rks has joined #ocaml
zhengli has quit [Quit: Leaving.]
mnabil has quit [Read error: Operation timed out]
boscop_ has joined #ocaml
boscop_ is now known as boscop
<mrvn>
Concerning oribas question about having multiple "new" for a class. Can't one declare a class type and then create 2 implementations of it?
<EliasAmaral>
mrvn, two classes with same method signatures are compatible
<EliasAmaral>
maybe not directly but you can coerce them safely
<EliasAmaral>
and if they aren't exactly compatible, you can write down a type that is more general than both (but it is inconvenient)
<EliasAmaral>
the <methods> type
zhengli has joined #ocaml
avsm has quit [Ping timeout: 255 seconds]
avsm1 has joined #ocaml
<mrvn>
EliasAmaral: which would give you 2 seperate new signatures that effectively give you the same class.
<mrvn>
Code duplication is probably a problem though if you can't move methods into a common base class.
<mrvn>
Did I mention that I hate singletons?
Lajla has quit [Read error: Connection reset by peer]
Lajla has joined #ocaml
<mrvn>
Maybe I'm using the wrong idea here. I have a Journal module that keeps a record of transactions on disk so they can be replayed after a crash. The module is a singleton as there can only be one journal and passing it around as argument seems wastefull. The journal needs to initialized on startup either from scratch or from an existing file on disk. In both cases the filename is given as command line argument. How would you
alexyk has joined #ocaml
avsm1 has quit [Quit: Leaving.]
<gildor>
mrvn: what I usually do is to filter command line argument and then call Arg.parse on the relevant arguments
<gildor>
so you can initialize your module in a "let () = " of the module and provide the args that should be present for the main, but in this case, they initialize nothing
<mrvn>
Currently I have let fd = ref (Obj.magic -1) and then later I replace that when I open the file
<gildor>
with my method you can bypass this black magic
<gildor>
but the module need to be initialized using env (CLI or env var) only
<mrvn>
how? How do I get the filename before the main function does argument parsing?
alexyk has quit [Read error: No route to host]
<gildor>
mrvn: just use Arg.parse_argv in your let fd =
<gildor>
and filter the command line to extract "--module-filename fn"
<mrvn>
hmm, I was having a server that runs with a journal and a format tool that initialy creates one. The Journal module would have to parse the command line and then somehow find out which of the 2 binaries it is used from currently.
<mrvn>
I guess I can add a --format option to the server and have just one binary.
<gildor>
match
yezariaely has quit [Quit: Leaving.]
<gildor>
match Sys.executable_name or Sys.argv.(0)
<mrvn>
verry bad if someone renames it.
<gildor>
I don't understand then, if it gives a filename why do you need to know which binaries generate it ?
NaCl is now known as SodiumChloride
<mrvn>
gildor: because creating a new journal (or wipeing the old) should not parse the existing file.
<gildor>
mrvn: In both cases the filename is given as command line argument. How would you -> I answer to this question from you
<mrvn>
The server mode opens the file, reads in the signature, gets the uuid, size and other infos fro the header and then loads in all the unfinished transactions and queues them up for restart.
<gildor>
what is the pb with the solution I propose to you ?
<mrvn>
nothing. Just not a nice one.
<gildor>
what would you prefer ?
<gildor>
what is ugly ?
<mrvn>
something more reusable where the journal module doesn't dictate the command line interface.
<gildor>
Ob.magic is probably the most ugly solution ;-)
<gildor>
the solution I propose is a little bit less ugly
<gildor>
the best solution, is maybe using functor
<gildor>
(but this is tricky)
<mrvn>
A Unix.file_descr option would be nicer than Obj.magic but then every use of fd has to extract the option type. Sucks too.
<mrvn>
gildor: a functor over a module that parses the command ine and outputs the filename?
<gildor>
no
<gildor>
but initialization of functor can be triggered in a let module M = Module(struct let fd = open_file "toto" end) in let open M in
<mrvn>
That is what I ment basically.
<gildor>
this is ultra tricky and this is what mfp use to triggered initialization of module during ocsigen intialization
<gildor>
you can try, but I have played with it and it is really not nice because it is quite undocumented initialization sequence
<mrvn>
isn't initialization done in order of linking (which means in order of depends)?
<gildor>
mrvn: with functor and local module you can change the initialization order
<gildor>
mrvn: though, the first solution, is easier to understand and to maintain on the long term
<mrvn>
ahh, he has closure arund the module. So the initialization is done when the closure is evaluated.
<gildor>
mrvn: yep, basically you should replace this closure by the function of your Arg parsing
* gildor
think this is a dangerous solution
<mrvn>
I will probably use Global.journal_name and Global.format in the Journal module and move the command line parsing into the Global module.
<mrvn>
lets start with learning the Args module. I only used Getopt before.
<mrvn>
Or maybe not. Args doesn't seem to have support for short and long options like getopt has.
<flux>
you can put the option in twice
<flux>
but I suppose it's less than optimal
<mrvn>
and usage then displays it twice
rwmjones has quit [Ping timeout: 260 seconds]
ikaros has joined #ocaml
<EliasAmaral>
mrvn, whatever the problem at hand, i have found that OO in ocaml doesn't.. fit. (which is a shame, because i loved that row typing stuff)
alexyk has joined #ocaml
<EliasAmaral>
is there some ocaml library for reading a mesh format blender can save? for use with some opengl library
<alexyk>
gildor: when can I say oasis-install some-pkg? :)
<flux>
hmm, I have a parser for one of those formats
<flux>
unfortunately it seemed to me that the normals go wrong in the format
<flux>
but perhaps it's been fixed
<flux>
eliasamaral, I can put the sources on-line once I get home
<gildor>
alexyk: working on it
<alexyk>
gildor: down with GODI, honestly, it's unwieldy and oasis-install would simply replace it, I think :)
<EliasAmaral>
would be helpful flux :) i'm currently thinking if i should bother doing this with ocaml
<alexyk>
gildor: I was able to compile ocaml-expect release, then oasis built from darcs
<gildor>
alexyk: good news
<gildor>
alexyk: what are you pb with GODI
<gildor>
?
<flux>
eliasamaral, well, it's nice if the sources find some use, the actual project behind it has not advanced at all :)
<gildor>
alexyk: you can reply to me privately, if you want
<EliasAmaral>
actually my problem isn't going to be rendering, but collision detection. i need to use some dumb algorithm so that i hope it to be correct. (i am thinking in using some engine, but i can never wrap my mind to use a huge code library, with all its quirks..)
<alexyk>
gildor: I think the whole interface of GODI is inconvenient.
<alexyk>
I used godi_console and it's painful
<gildor>
like the curses interface .
<gildor>
ok, this is indeed at the same time not very convenient and not very portable
<alexyk>
gildor: cabal-install is a simpler and better model
<alexyk>
like apt-get, etc.
<gildor>
but, in my current spec, I won't handle external C stuff
<gildor>
e.g. I won't compile for your libpcre
<gildor>
only pcre-ocaml
<gildor>
whereas GODI will compile libpcre for you
<EliasAmaral>
i could try c++, but then i have even less faith that my code could be correct
<flux>
I've been playing with my new kinect the last few days
<gildor>
this is an intended limitation, because I don't have the workforce to create something that compile C projects
<flux>
too bad opencv doesn't appear to have ocaml bindings
<flux>
so c or c++ it is
<EliasAmaral>
opencv?
<alexyk>
gildor: what does Haskell do? I guess it assumes PCRE is installed?
<flux>
it's a computer vision library
<gildor>
alexyk: yes, cabal-install don't compile libpcre as well
<EliasAmaral>
oh, the microsoft thing?
joewilliams_away is now known as joewilliams
<flux>
eliasamaral, yep
<EliasAmaral>
i heard about the open source driver, seems cool. (i wonder if a webcam couldn't do something similar though)
<alexyk>
gildor: I'd say if you replicate cabal-install with oasis-install, it will be the biggest OCaml revolution since the Bastille!
<flux>
eliasamaral, it couldn't. this has an infrared laser which it uses to find out the depth of each pixel.
<EliasAmaral>
or maybe two :)
<flux>
well, opencv has stereo image depth extraction as well
<flux>
but I seriously doubt it's going to work as well
<flux>
eliasamaral, check out some of the kinect videos on youtube
<EliasAmaral>
humans can do this without laser. but we can easily be fooled
<mrvn>
Would be nice if I could write let o = { base_port = get_arg port_arg (Some 2000); ...}
_andre has quit [Quit: leaving]
lamawithonel_ has quit [Read error: Connection reset by peer]
lamawithonel_ has joined #ocaml
_andre has joined #ocaml
<mrvn>
*grummel* Now I need to rewrite my core IO select loop. The code I currently have can't handle unix domain sockets, specifically transfering Unix.file_descr over it.
init1 has quit [Quit: Lost terminal]
init1 has joined #ocaml
init1 has quit [Client Quit]
init1 has joined #ocaml
wormphlegm has joined #ocaml
init1 has quit [Quit: Lost terminal]
ftrvxmtrx has quit [Quit: Leaving]
tictactoc has left #ocaml []
<flux>
hcarty, tempting idea, but I sense it'd be a big project ;)
<flux>
hcarty, maybe if the c++ binding generator tols/lins were more complete..
<adrien>
don't they have a C interface too?
<adrien>
(and I didn't really like how opencv seemed to manage its memory last time I looked)
dskippy1 has quit [Ping timeout: 260 seconds]
khia0 has joined #ocaml
WonTu has joined #ocaml
WonTu has left #ocaml []
<hcarty>
flux: Yes, it would probably take a bit more than a weekend :-)
<hcarty>
adrien: They do have a C interface. And it seems to use a large number of custom data types/wrappers.
alexyk has joined #ocaml
rwmjones has quit [*.net *.split]
asmanur has quit [*.net *.split]
rixed_ has quit [*.net *.split]
orbitz has quit [*.net *.split]
pheredhel has quit [*.net *.split]
fremo__ has quit [*.net *.split]
rks has quit [*.net *.split]
dskippy has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
<EliasAmaral>
flux, uhm. i have two options: doing a simple demo in bare opengl.. but modelling with blender. (thus your file format reader would be useful, if i did in ocaml). or using some engine. i am looking at irrlicht and blender game engine. any thoughts?
wormphle1m has joined #ocaml
<EliasAmaral>
i don't like the feeling of defining interactivity elements on the blender UI. i think i would like to use blender just for graphics. but i am thinking, it is hard to separate the graphics from the interactivity
wormphle1m has quit [Read error: Connection reset by peer]
<EliasAmaral>
so maybe blender would have to at least label the parts and so on
<flux>
eliasamaral, I haven't really looked at other options
<EliasAmaral>
aseTest is the test program right? (do you have some makefile?)
wormphle1m has joined #ocaml
<flux>
aseTest is quite minimal as you can see..
<flux>
I use OCamlMakefile
<flux>
in any case that's part of another project
<EliasAmaral>
looks nice, i just need some .ase file
<flux>
compiling it with pa_refutable is the trickies part for someone who's new to ocaml
wormphle1m has quit [Client Quit]
<flux>
actually it only uses 'let refutable' just once, so you can just remove the refutable-keyword and forget pa_refutable.ml :)
<flux>
(it produces a warning)
<EliasAmaral>
i don't know if i qualify as new, but if that's a syntax i think i would use ocamlfind .. -syntax ..
<flux>
well, almost
<EliasAmaral>
i think one can substitute let <..> = x in .. with match x with <..> -> .. | _ -> failwith ?
<flux>
yes
<flux>
to avoid the warning
<flux>
I think it goes like -syntax camlp4o -package foo.syntax
<flux>
but I'm not certain :)
wormphlegm has quit [Read error: Connection reset by peer]
smerz has joined #ocaml
<EliasAmaral>
anyway will try later, thanks
wormphlegm has joined #ocaml
alexyk has quit [Quit: alexyk]
pheredhel has joined #ocaml
fremo__ has joined #ocaml
orbitz has joined #ocaml
rixed has joined #ocaml
asmanur has joined #ocaml
rks has joined #ocaml
<mrvn>
Anyone have the code to read an int option value in C code at hand?
<mbac_>
can i tell the ocaml GC to let the heap grow to N size before it ever attempts a compaction?
<mbac_>
ideally i'd tell my process to use almost as much RAM as the machine has for the heap, and only compact to avoid hitting swap
<adrien>
(my issue with lablgtk2 was an incorrect and undocumented assumption in the C bindings which took me some time to find and fix)
<mrvn>
mbac_: I would like to tell the kernel to give me a kick before it starts swapping me.
<hcarty>
mbac_: The Gc.get and Gc.set parameters may do what you want
<hcarty>
s/parameters/functions/
<mbac_>
they may, i'm not sure how to interpret them for my needs though
<mbac_>
mrvn, set up a script to watch vmstat output
<mrvn>
mbac_: too late. The GC should do compaction slightly BEFORE the kernel swaps it out
alexyk has joined #ocaml
<mbac_>
what do you mean too late?
<mbac_>
for me or for you?
<adrien>
bad idea of the evening: set space_overhead to something higher than 100, it looks like it's possible :P
<mrvn>
for the GC
<mbac_>
you can interpret vmstat's output to tell you when you're almost about to swap
<mrvn>
mbac_: with some luck. but you don't know if it is going to swap the ocaml process or iceweasel.
<mbac_>
true
<mbac_>
"swap a process out" is a rare operation though
<mbac_>
what's more probable is swap random pages from all processes out
<mbac_>
in my case i'm happy to reserve the entire machine for an ocaml process
<mbac_>
so if anything is swapping i can be reasonably certain it's my ocaml process
rwmjones has joined #ocaml
Snark has quit [Quit: Ex-Chat]
EliasAmaral has quit [Ping timeout: 240 seconds]
_andre has quit [Quit: leaving]
alexyk has quit [Quit: alexyk]
alexyk has joined #ocaml
avsm has joined #ocaml
alexyk has quit [Quit: alexyk]
avsm has quit [Quit: Leaving.]
McRip has joined #ocaml
<McRip>
Hello everybody, I have a quite basic Caml-problem and hope to find some quick response here... :): If I have a type-definition: type foo = Bar of int;; and now want to treate Bar as an integer e.g. in a matching-operation: let func test:Bar = match test with | int -> 5;;. How do I manage this? The compiler correctly complains, that test is no integer but an Bar, but that should be equivalent to an integer...
<McRip>
this should be some kind of "type-upcasting" I think...
<thelema>
match Bar 3 with Bar x -> x ??
<thelema>
let f (test : foo) = match test with Bar x -> 5
wormphlegm has left #ocaml []
<McRip>
and if I want to match test to an integer? let f (test:foo) = match test with int x -> 5;; should not work...
<thelema>
test can't be an integer - it can be a (Bar int)
<thelema>
type foo = A of int | B of int
<thelema>
let f test = match test with A x -> x+1 | B x -> 2 * x
<thelema>
I guess you could do: let f (Foo x) = match x with 1 -> "one" | 2 -> "two" | _ -> "other"
<thelema>
I'm still not sure what you're trying to do with matching test to an integer
<McRip>
Maybe it helps if I post the original sourcecode...one moment...
<thelema>
rather, let f (Bar x) = ...
<thelema>
match can't match types - those aren't available at runtime to match against
<McRip>
I think basically I want to treate some object as an object of it's "basetype"...
<jm_ocaml>
the OPlane and OSphare constructors in the last match are missing their arguments
<thelema>
let f1 = function Oplane (x,y) -> oplane_action x y | OSphere (x,y,r) -> osphere_action x y r
<jm_ocaml>
try replacing OPlane by OPlane _
<thelema>
and you probably want to use List.iter to run through your list of instructions
<thelema>
oops, there's one more level of matching...
<McRip>
sorry, the original code includes the constructors... I think the problem is the double-level of matching...
<thelema>
let act x = match x with Put (Oplane (x,y)) -> oplane_action x y | Put (OSphere (x,y,r)) -> osphere_action x y r | Assign (s, exp) -> Hashtbl.add ht s exp
<thelema>
whatever your oplane/osphere actions are
<thelema>
let func instructions = List.iter act instructions
<thelema>
(I assume you don't want to just do the first instruction in your list.
<McRip>
aaaaah okay! Thank you very much, now I understood!
<thelema>
nested matchings usually aren't needed
ulfdoz has quit [Ping timeout: 246 seconds]
<thelema>
as a single match statement can handle multiple levels of structure
<McRip>
That is quite elegant! But very new for me since I am coming from the c++-direction... :)
<McRip>
Thanks again, you helped me a lot!
<thelema>
yes, talking about objects so much doesn't help people here answer your question
dskippy has joined #ocaml
oriba has joined #ocaml
dskippy has quit [Ping timeout: 240 seconds]
<gildor>
hcarty: pong
<gildor>
hcarty: SCM browser on ocamlmpi, that is your problem
<hcarty>
gildor: Yes - is it a problem on my end, or something server-side?
<gildor>
hcarty: problem arise around 17:00 PM
<gildor>
hcarty: just fix
<gildor>
if you look again you will see it is now ok
<gildor>
it was due to removal of the package gforge-plugin-scmsvn in favor of fusionforge-plugin-scmsvn
<gildor>
(there was the same problem with CVS, but nobody seems to have notice ;-)
dskippy has joined #ocaml
<hcarty>
gildor: Thanks for the update :-) Yes, everything looks good here now.