<phao>
Hi. I am new to dealing with trees. I am a little used to functional programming, and the most advanced data structure I dealt with was the list (in lisp, and now here). In trees, I do things like this (I am implementing a heap as explained in the book) http://pastie.org/pastes/4042357/text
<phao>
And this is not so much related to ocaml, but to how this is done... it seems "wrong" reconstructing the tree like that, because it looks like I am doing a lot unnecessary computation
manu3000 has quit [Quit: manu3000]
<phao>
I am not sure if I need them. But is this normal/
<phao>
?
Hussaind has joined #ocaml
<phao>
(funny the book suggests a much simpler implementation than mine, hehe)
Hussaind has left #ocaml []
caligula_ has quit [Remote host closed the connection]
caligula has joined #ocaml
<ssbr>
Is there some better way to do this? "List.map Option.get (List.filter Option.is_some (List.map (fun x -> try Some (Hashtbl.find mytable x) with Not_found -> None) my_possible_keys))"
<ssbr>
Oh, wait, I can cut that down to just a map and filter by doing the containment check first
<ssbr>
Still, any list comprehensions or anything?
<lin>
ssbr: you need a filter_map function like this
<lin>
val filter_map : 'a list -> f:('a -> 'b option) -> 'b list
<ssbr>
lin: Well, it's fine if I rewrite it the way I did (to do a map of Hashtbl.find ht on a filter of Hashtbl.mem ht on the list of maybe-keys)
<ssbr>
I guess I wrote it the way I did because I thought there'd be a function of 'a option list -> 'a list in Option
<ssbr>
or yeah, I guess your filter_map is what Haskell has -- mapMaybe
<ssbr>
Oh, but there is catMaybes, which is what I wanted ;)
<lin>
indeed I get it from janestreet 's core library
<lin>
ssbr: there are bunches of functions for list in ther Core.Std.List module
<ssbr>
(also, while I may have only the most tenuous of grasps of SML syntax, it looks good to me...)
oriba has joined #ocaml
<ssbr>
... OK, so the problem was that lsl was an infix function, not a prefix function
<ssbr>
this is apparently bad enough to break error reporting in camlp4. Woooooo.
Sablier has joined #ocaml
ftrvxmtrx has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
jlouis has joined #ocaml
Ptival has quit [Read error: Connection reset by peer]
ocp has joined #ocaml
Ptival has joined #ocaml
Ptival has quit [Read error: Connection reset by peer]
Ptival has joined #ocaml
avsm has joined #ocaml
hto has quit [Ping timeout: 240 seconds]
phao_ has joined #ocaml
phao has quit [Disconnected by services]
phao_ is now known as phao
eni has quit [Quit: Leaving]
hto has joined #ocaml
avsm has quit [Quit: Leaving.]
snearch has joined #ocaml
snearch has quit [Remote host closed the connection]
snearch has joined #ocaml
snearch has quit [Read error: Connection reset by peer]
snearch has joined #ocaml
snearch has quit [Read error: Connection reset by peer]
emmanuelux has joined #ocaml
snearch has joined #ocaml
snearch has quit [Client Quit]
snearch has joined #ocaml
Yoric has joined #ocaml
Kakadu has joined #ocaml
<Kakadu>
hi all!
ankit9 has joined #ocaml
ankit9 has quit [Client Quit]
<phao>
hi
<Kakadu>
If I plan to crosscompile OCaml to ARM/Android devices It should better don't use libraries with big dependencies on glibc (like Core)?
<phao>
Kakadu, not that I understand about that, but why you think not?
<Kakadu>
phao: AFAIR android has another libc and maybe some functions which use unix features will fail linking?
osa1 has joined #ocaml
<phao>
hmm, I thought android was some sort of linux (understand I am just guessing based on some little things I heard)
<phao>
linux uses, I think all distros do, glibc
<phao>
but.... I was just curious anyway =) I think if you wait long enough, other people will help you... maybe asking in an android channel too (if there is one) should help
thomasga has joined #ocaml
<adrien>
phao: android's libc is a pretty funny story
<adrien>
they started with another one that skipped some features
<adrien>
then, of course, they had to add more
<adrien>
now I'm not sure it's missing a lot of things
benozol has joined #ocaml
<adrien>
(it's called "bionic" iirc)
<phao>
google people are funny
<phao>
they seem very capable, but build some at least "funny" software
<phao>
this one (new to me), and chrome (which I really don't like)
ankit9 has joined #ocaml
<phao>
of course that... there are all the other software they've built and I'm not aware of; so I can't really say anything
oriba has quit [Quit: oriba]
Yoric has quit [Ping timeout: 264 seconds]
eikke has joined #ocaml
benozol has quit [Ping timeout: 248 seconds]
benozol has joined #ocaml
Yoric has joined #ocaml
<osa1>
anyone experienced with metaocaml here? I'm having trouble running metaocaml, i can't evaluate even the simplest expression: https://gist.github.com/2877853
Kakadu has quit [Ping timeout: 245 seconds]
ulfdoz has quit [Ping timeout: 260 seconds]
ulfdoz has joined #ocaml
<f[x]>
osa1, what version of metaocaml?
<f[x]>
"3.09.1 alpha 030" works fine
<osa1>
f[x]: latest version
<osa1>
f[x]: I had already have an ocaml installed on my system and I installed metaocaml on top of it, could it be related with this?
<f[x]>
latest
<f[x]>
very exact
<f[x]>
also check that file $(metaocamlc -where)/trx.cmi exists
<f[x]>
show metaocamlc -where and ocamlc -where
<f[x]>
what do you mean on top?
zorun has quit [Ping timeout: 244 seconds]
<osa1>
f[x]: I mean I didn't uninstall current ocaml installation(because makefile doesn't have uninstall command) before installing metaocaml
<f[x]>
no need to uninstall - just install in different prefixes
<osa1>
ooh, wait, there's another executable called metaocaml
<osa1>
damn, I was running ocaml ..
zorun has joined #ocaml
<osa1>
f[x]: I couldn't find a way to show library files to executables when I install it with -prefix
<f[x]>
not install with prefix - but configure with prefix
<f[x]>
then executables will have path to libs hardcoded in binary
<osa1>
f[x]: yeah I think my problem was because I was running ocaml instead of metaocaml. thanks.
* rixed
has to lookup the manual for the syntax of the for loop :-p
Kakadu has joined #ocaml
osa1 has quit [Ping timeout: 246 seconds]
zorun__ has joined #ocaml
zorun has quit [Ping timeout: 248 seconds]
zorun__ is now known as zorun
zorun has quit [Quit: ≈O≈]
zorun has joined #ocaml
snearch has quit [Quit: Verlassend]
avsm has joined #ocaml
Submarine has quit [Ping timeout: 252 seconds]
fraggle_ has quit [Ping timeout: 256 seconds]
ankit9 has quit [Ping timeout: 244 seconds]
fraggle_ has joined #ocaml
ankit9 has joined #ocaml
lin has quit [Quit: 离开]
zorun__ has joined #ocaml
zorun has quit [Ping timeout: 246 seconds]
smondet has joined #ocaml
zorun__ has quit [Client Quit]
zorun has joined #ocaml
<rixed>
Is there a way to peek a byte or two from a BatIO.input? Or to put them back in the read buffer once read?
<thelema_>
rixed: convert to an enum and then peek and push
lin has joined #ocaml
<rixed>
thelema_: I'd like to be able to call IO reading functions on this, so an enum will not be very practical :-/
<rixed>
thelema_: Wait, I'm going to have a look at how scanf does, since it probably need to peek next byte too...
<thelema_>
rixed: BatIO.input can be converted to an enum efficiently
<rixed>
Yes but my program call the IO.read_* functions, so I'd have to convert it to use a char enum instead
<thelema_>
ah, n/m... hmmm
<thelema_>
I assume you're doing binary IO?
<rixed>
thelema_: yep.
<rixed>
thelema_: heu, no. not in this stream.
<thelema_>
my general solution for this is to just use bitstring. Pattern matching on bits is quite nice.
<rixed>
thelema_: actualy I'm competing with a very fast C++ program so I'd rather not use too much abstractions :)
<rixed>
the disk is supposed to be the bottleneck
<rixed>
but for now it's my parsing function...
<thelema_>
bitstring is more efficient than you would expect. It's got sections that are optimized to asm.
<thelema_>
(iirc)
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
<rixed>
thelema_: I believe it's fast for dealing with bits, but not for dealing with bytes. But I never benchmarked it.
osa1 has joined #ocaml
<rixed>
Anyway, I'm going for the char enum. thanks for the tip.
osa1 has quit [Ping timeout: 244 seconds]
ocp has quit [Ping timeout: 246 seconds]
hcarty has joined #ocaml
osa1 has joined #ocaml
<thelema_>
rixed: to be honest, if you're going for performance, you may not want to do the char enum.
benozol has quit [Ping timeout: 244 seconds]
<thelema_>
although maybe it's not as bad as I'm thinking - it'll call read_byte from the input...
fraggle_ has quit [Read error: Connection reset by peer]
phao has quit [Quit: Not Here]
<rixed>
thelema_: yep. I merely added a small wrapper for the kind of textual input stream for wich I actually need the peek function...
osa1 has quit [Quit: Konversation terminated!]
osa1 has joined #ocaml
ankit9 has quit [Quit: Leaving]
ftrvxmtrx has quit [Quit: Leaving]
mika1 has joined #ocaml
cago has quit [Quit: Leaving.]
mika1 has quit [Quit: Leaving.]
Sablier has quit [Quit: Quitte]
silver has quit [Remote host closed the connection]
osa1 has quit [Ping timeout: 246 seconds]
avsm has quit [Quit: Leaving.]
Kakadu has quit [Quit: Page closed]
Sablier has joined #ocaml
Snark has joined #ocaml
eikke has quit [Ping timeout: 248 seconds]
Submarine has quit [Ping timeout: 248 seconds]
benozol has joined #ocaml
<jaxtr>
ahh it's a wonderful day
eikke has joined #ocaml
avsm has joined #ocaml
andreypopp has quit [Quit: Computer has gone to sleep.]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.2]
Yoric has quit [Ping timeout: 246 seconds]
<hcarty>
thelema_: Do you know how long the oasis-db admin interface has been down?
wtetzner has quit [Read error: Connection reset by peer]
eni has joined #ocaml
wtetzner has joined #ocaml
thomasga has quit [Quit: Leaving.]
osa1 has joined #ocaml
<osa1>
is there a print function to print an object's string representation?
<_habnabit>
osa1, arbitrary objects don't have string representations
<_habnabit>
osa1, so, not really
ftrvxmtrx has joined #ocaml
Sablier_ has joined #ocaml
Sablier has quit [Ping timeout: 246 seconds]
Xizor has joined #ocaml
pangoafk is now known as pango
eni has quit [Quit: Leaving]
lin has quit [Remote host closed the connection]
rgrinberg has quit [Read error: Connection reset by peer]
eikke has joined #ocaml
<mehdid>
osa1: you may try BatStd.dump
eikke has quit [Ping timeout: 248 seconds]
bitbckt has quit [Read error: Operation timed out]
bitbckt has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 248 seconds]
thomasga has joined #ocaml
avsm has quit [Quit: Leaving.]
fraggle_ has joined #ocaml
avsm has joined #ocaml
<thelema_>
hcarty: hmm, didn't realize it was down. ah, it's not down, you just have to log in. It gives a *terrible* error when you're not logged in.
Obfuscate has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm has quit [Client Quit]
avsm has joined #ocaml
Obfuscate has joined #ocaml
hongboz has joined #ocaml
eikke has joined #ocaml
* tchell
tries to understand why the PXP_document.document type has a parameter.
eikke has quit [Ping timeout: 244 seconds]
* adrien
finally got his cross gnu-toolchain working
<Qrntz>
adrien, «cross» from-to?
Snark has quit [Quit: Quitte]
<adrien>
slackware64 to i686-w64-mingw32
<adrien>
shouldn't be an issue to do to x86_64-w64-mingw32
<adrien>
dinner
<Qrntz>
interesting
<tchell>
how can PXP return me an actual value (parsed XML document) of type ('a Pxp_document.node Pxp_document.extension as 'a) Pxp_document.document ?
<jonafan>
I think pgocaml is the coolest thing ever made
<tchell>
wouldn't all the type parameters have been specified by the time it creates the actual value?
<mrvn>
tchell: it can if it is type +'a t
<mrvn>
like []
<tchell>
ok, I can imagine that, but even the non-trivial ones have a parameter. Actually all of them.
<tchell>
like when I parse a big xml file, the toplevel says it is the type listed above.
<thelema_>
Does anyone have a version of findlib that works with ocaml 4.00? AFAICT, 1.3.1 doesn't work because of the change of location of compiler-libs
emmanuelux has quit [Read error: No route to host]
thomasga has quit [Quit: Leaving.]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
Yoric has quit [Remote host closed the connection]
sepp2k has quit [Read error: Connection reset by peer]
mal`` has quit [Ping timeout: 244 seconds]
mal`` has joined #ocaml
<adrien>
also, I'll be looking for beta-testers for the new set of yypkg packages
<adrien>
this time it includes a bootstrapped-toolchain (while I was "merely" reusing the automated builds of mingw-w64 before)
<adrien>
the set of packages is quite small since I only have the cross-toolchain right now so it won't take long to test
<adrien>
(the x-toolchain is distributed as a set of packages that can run inside a basic slackware64 chroot which is maybe around 40MB when compressed)
<jonafan>
i think i have finished a site in ocsigen
<jonafan>
hopefully this is the beginning of a new era in my life: using ocaml for stuff
<Qrntz>
jonafan, do you plan on making it (or at least some parts of it) opensource
<Qrntz>
I'm still struggling with some ocsigen aspects
<jonafan>
yeah ocsigen is a bit obtuse
<jonafan>
the documentation on the website is a big hard to work with
<jonafan>
and there are not many examples out there
<jonafan>
what are you having trouble with?
<Qrntz>
this may sound stupid
<Qrntz>
but implementing a static file service that doesn't readily serve /etc/passwd
<Qrntz>
because the one from the examples does that
ocp has quit [Read error: Operation timed out]
<Qrntz>
and yes, the documentation is pretty rough
<thelema_>
:) apparently I should have just used ocamlbrew instead of overwriting my system ocaml install
<hcarty>
thelema_: :-)
<thelema_>
yay, apparently what I did is also in the patch.
<hcarty>
thelema_: What is the state of Batteries + OCaml 4.0?
<hcarty>
thelema_: And thanks regarding oasis-db - I thought I was logged in but wasn't.
oriba_ has joined #ocaml
Tobu has quit [Ping timeout: 248 seconds]
<mfp>
Qrntz: it depends on the order in which the extensions are declared in your configuration --- if <static dir=...> comes before <eliom ..., the static service takes preference
oriba has quit [Ping timeout: 260 seconds]
ocp has quit [Ping timeout: 252 seconds]
Tobu has joined #ocaml
Sablier_ has quit [Read error: Connection reset by peer]
cdidd has quit [Remote host closed the connection]
thomasga has quit [Quit: Leaving.]
benozol has quit [Quit: Konversation terminated!]
srcerer has quit [Quit: ChatZilla 0.9.88.2 [Firefox 12.0/20120420145725]]