Alpounet changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html - Answer OCaml Meeting 2010 poll https://forge.ocamlcore.org/survey/survey.php?group_id=77&survey_id=1
ofaurax has quit ["Leaving"]
thrasibule_ has joined #ocaml
thrasibule has quit [Read error: 104 (Connection reset by peer)]
c0m has quit [Read error: 104 (Connection reset by peer)]
c0m has joined #ocaml
thrasibule_ has quit [Read error: 60 (Operation timed out)]
julm has quit ["leaving"]
ccasin has quit ["Leaving"]
julm has joined #ocaml
onigiri has quit [Read error: 60 (Operation timed out)]
mattam has quit [Remote closed the connection]
mattam has joined #ocaml
tmaedaZ is now known as tmaeda0
onigiri has joined #ocaml
julm has quit [Remote closed the connection]
julm has joined #ocaml
onigiri has quit [Remote closed the connection]
onigiri has joined #ocaml
<mbac> repeat, but only because i don't see the question in my scrollback buffer anymore. suppose i had type fnuh = Foo | Bar | Baz ;; is there a magic short expression that will evaluate to [Foo; Bar; Baz] ?
<mbac> does the fact that i'm even thinking about this mean i'm doing something wrong?
Amorphous has quit [Read error: 113 (No route to host)]
Amorphous has joined #ocaml
<thelema> mb: there isn't, but since such types are static, it's not difficult to copy/paste the type, s/|/;/ and add some []
ztfw has quit [Read error: 54 (Connection reset by peer)]
ztfw` has joined #ocaml
caligula__ has joined #ocaml
caligula_ has quit [Read error: 60 (Operation timed out)]
_unK has quit [Remote closed the connection]
Mr_Awesome has quit [Client Quit]
<palomer> what's the easiest way to input a whole file?
<palomer> ahh, in_channel_length
tmaeda0 is now known as tmaeda
jeff_s_ has joined #ocaml
<jeff_s_> is it right that +, - and * are the same for unsigned integers and 2's complement integers, but / and mod are not?
<orbitz> in general?
<jeff_s_> right
caligula_ has joined #ocaml
ulfdoz has joined #ocaml
caligula__ has quit [Read error: 60 (Operation timed out)]
jeff_s_ has left #ocaml []
ulfdoz has quit [Read error: 110 (Connection timed out)]
valross has quit ["Ex-Chat"]
Yoric[DT] has joined #ocaml
ttamttam has joined #ocaml
mishok13 has joined #ocaml
ygrek has joined #ocaml
onigiri has quit []
julm has quit [Read error: 54 (Connection reset by peer)]
Yoric[DT] has quit ["Ex-Chat"]
julm has joined #ocaml
ikaros has joined #ocaml
Submarine has joined #ocaml
Alpounet has quit [Read error: 60 (Operation timed out)]
Submarine_ has joined #ocaml
Submarine_ has quit [Client Quit]
julm_ has joined #ocaml
julm has quit [Read error: 60 (Operation timed out)]
_zack has joined #ocaml
tmaeda is now known as tmaedaZ
tmaedaZ is now known as tmaeda
munga has joined #ocaml
Snark_ has joined #ocaml
reid97 has quit [Read error: 110 (Connection timed out)]
reid97 has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
ikaros has quit [Client Quit]
tmaeda is now known as tmaedaZ
ikaros has joined #ocaml
ygrek has quit [Remote closed the connection]
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
<tiz> Hi all... trying to use ocamlfind + godi. I have installed a library in <PREFIX>/lib/ocaml/site-lib (according to the docco the correct place for "User-installed (non-packaged) add-on O’Caml libraries", but the compiler isn't finding the cmi file.
<tiz> ocamlfind query -i-format is outputting a path containing <PREFIX>/lib/ocaml/std-lib instead of <PREFIX>/lib/ocaml/site-lib.
<tiz> So ocamlfind seems think the library is somewhere it isn't.
<tiz> Can anyone point me in the right direction?
<tiz> Sure it's probably my fault as I am an ocamlfind n00b but I can't see what I'm doing wrong.
<Camarade_Tux> I think that's a pretty common problem with godi and *I* know of no solution beside creating a symlink between the two places (or copying the package)
<tiz> OK, thanks Camarade_Tux.
<ttamttam> tiz: maybe, you can edit findlib.conf
<ttamttam> to add site-lib in "path"
<tiz> It's already there.
<tiz> And if I use strace, I can see that ocamlfind is locating the package's META file.
<Camarade_Tux> when I last had this problem, I tried to install with the -destdir option, ocamlfind was completely lost
<ttamttam> No idea then. sorry
<Camarade_Tux> I think there's something non-standard about godi's oamlfind =/
<tiz> *sigh* it seems to be broken in other ways anyway, think I'll just go back to hand-crafted Makefiles with hard-codes paths :`(
<tiz> *coded
<Camarade_Tux> what is your problem? this is probably the only one I ever had with godi+ocamlfind
<ttamttam> I myself had no problem, despite my use of Win... + GODI + my own packages
<tiz> soft-linking the directory doesn't work, because there is another problem:
<tiz> $ ocamlfind query -i-format fuse
<tiz> -I /home/jim/local/godi/lib/ocaml/std-lib/fuse +stubs
<tiz> Presumably there should be another -I before +stubs ? This whole line is getting treated as a path
<ttamttam> certainly
<Camarade_Tux> yup, think so
<tiz> directory = "+fuse +stubs"
<tiz> That's the offending line from the META file, presumably the wrong syntax is being used for multiple directories?
<Camarade_Tux> and what does this do? ocamlfind -query -format '-I%d' fuse
<ttamttam> And : The value must be either: an absolute path name of the alternate directory, or a path name relative to the stdlib directory of OCaml (written "+path"), or a normal relative path name (without special syntax).
<Camarade_Tux> errr, with a space, but it should do nothing different
<tiz> $ ocamlfind -query -format '-I%d' fuse
<tiz> -I/home/jim/local/godi/lib/ocaml/std-lib/fuse +stubs
<Camarade_Tux> can you pastebin the META for fuse?
<Camarade_Tux> oh, no need to
<ttamttam> I think "directory" means one path only, according to http://projects.camlcity.org/projects/dl/findlib-1.2.5/doc/ref-html/r647.html.
<Camarade_Tux> can you try to change the META with:
<Camarade_Tux> directory="+fuse"
<Camarade_Tux> directory="+stubs"
<Camarade_Tux> ?
<tiz> Complains about the double definition of directory.
<tiz> Though, if I remove the "+stubs" entirely, it finds the right directory but gives me the error "/home/jim/local/godi/lib/ocaml/std-lib/fuse/fuse.cmi is not a compiled interface"
<tiz> I think maybe my libfuse compile has *many* problems :)
<Camarade_Tux> yeah, from my experience, telling ocamlfind the path to the stubs is not needed
<tiz> Oh, that is an ocaml version problem apparently.
<Camarade_Tux> most likely
<tiz> I should be able to solve that one.
<tiz> Thanks for your assistance Camarade_Tux, ttamttam.
<Camarade_Tux> :)
ygrek has joined #ocaml
hto has quit [Read error: 60 (Operation timed out)]
ikaros has quit [Read error: 110 (Connection timed out)]
hto has joined #ocaml
ztfw` is now known as ztfw
munga has quit [Read error: 113 (No route to host)]
julm_ is now known as julm
_andre has joined #ocaml
thrasibule has joined #ocaml
waleee has joined #ocaml
ygrek has quit [Remote closed the connection]
Alpounet has joined #ocaml
tmaedaZ is now known as tmaeda
waleee has quit [Read error: 60 (Operation timed out)]
BiDOrD has quit [Read error: 110 (Connection timed out)]
BiDOrD has joined #ocaml
waleee has joined #ocaml
waleee has quit [Read error: 104 (Connection reset by peer)]
waleee has joined #ocaml
ikaros has joined #ocaml
Alpounet has quit ["Leaving"]
thelema has quit [Read error: 60 (Operation timed out)]
Alpounet has joined #ocaml
munga has joined #ocaml
david has joined #ocaml
david is now known as Guest38388
Guest38388 has quit [Client Quit]
Yoric has joined #ocaml
thelema has joined #ocaml
<mrvn> I'm building a package foo with modules bar and baz. I think I want the end result to have Foo.Bar and Foo.Baz but I don't want to put everything into one foo.ml. Is there a good way to build a foo.ml and foo.mli from bar.ml, bar.mli, bat.ml and baz.mli?
<mfp> mrvn: -pack
<mrvn> for what command?
<mfp> if you want to hide Foo.Bat, you'll have to generate foo.mli, though (just wrapping bar.mli and baz.mli with module Bar : ... and including the mli would do)
<mfp> compile with ocamlopt -for-pack Foo -c bar.ml etc
<mrvn> Thank, I will check the docs for that.
<mrvn> +s
<mfp> then ocamlopt -pack -o foo.cmx bar.cmx baz.cmx
<mrvn> With "hide" you mean have something in the mli that is usable within the library but not from outside?
<mfp> exactly
<mfp> the case of the Bat module in the example you gave, if I read it correctly
<mfp> ah bat.ml was a typo
<mrvn> That is one thing where C++ is unique I think. It has private, protected and public for its classes.
<mfp> aren't ML modules more powerful, since you can export types while keeping them abstract?
<mrvn> But you can not make something protected so modules that include the module can still use it.
<mrvn> or to hide things when you -pack them
<mfp> protected is indeed lacking
<mrvn> iirc ocaml classes can't access their parents values at all. Only call methods.
<mfp> mrvn: they can
<mfp> class foo = object val a = 1 end;;
<mfp> class bar = object inherit foo method a = a end;;
<mrvn> hmm, my bad.
<mfp> instance variables appear in the signature
<mfp> there's no way to qualify access though, AFAIK, so you cannot inherit two classes with the same instance variable
<mrvn> and for a "private" variable you would do class foo = let a = 1 in object end;;
<mfp> or mask the val in the signature
<mrvn> or that.
<mfp> hmm "Warning V: the instance variable a is overriden. The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)"
<mrvn> That covers private and protected. No public though. You need to define a method for that.
<mfp> right
<mfp> what's the new behavior?
<mrvn> And thanks to cross module inlining that shouldn't vene cost anything.
<mrvn> s/vene/even/
<mrvn> So maybe c++ isn't so unique. :)
<mrvn> Just wish modules would have something similar to limit exposure of things in the mli.
<mfp> ah got it, references to the instance variable in other classes point to the def in the last inherited class
<mfp> instead of keeping them separate
<mrvn> mfp: even if a method of that other class is called?
<mfp> I think so
* mfp tests
<mfp> yup, if I have val a in both class foo and class bar, and inherit them in that order, methods in foo see the value set in bar
<mrvn> I think C++ you get a mess with each sub-class seeing their own variable.
<mfp> unless you make the parent classes virtual, right?
<mrvn> This -pack is nice. I was afraid I would have to write module Bar = struct include bar end;; module Baz = struct include baz end;; or something.
<mrvn> mfp: virtual in c++ is pretty fine grained
<mfp> hmm actually that was only for inherited base classes IIRC
ccasin has joined #ocaml
eldragon has joined #ocaml
rwmjones has quit ["Leaving"]
rwmjones has joined #ocaml
<flux> pretty nice
<thelema> beautiful.
<flux> but I thought gprof works already? this somehow makes the support better?
<flux> line-specific counts, that's the thing?
<mfp> flux: it's support for valgrind/cachegrind, which can report precise L1/L2 cache info
<mfp> "Cachegrind simulates how your program interacts with a machine's cache hierarchy and (optionally) branch predictor. It simulates a machine with independent first level instruction and data caches (I1 and D1), backed by a unified second level cache (L2)."
* Camarade_Tux installs valgrind/cachegrind :P
<c0m> An interesting higher-order function is twice, which can be defined by let twice f = (fun x-> f (f x));; if we also define let successor n = n+1;; then we can evaluate expressions like (twice (twice (twice successor))) 0;; (* val it : int = 8 *) ... easy to see that k occurrences of twice, 2^k is returned... can you figure out a formula that gives the value of k occurences of twice?
<c0m> i don't understand that question .. seeing as how 2^k is the formula already, right?
<c0m> or is the question asking for any n
<c0m> not just 0
<mfp> c0m: I guess so
* mrvn goes and watches The Big Bang Theory
<c0m> mrvn: that was on tv last night, right?
<c0m> mfp: ok
<mrvn> yeah. torrents are great.
<c0m> what's that show about again?
<Camarade_Tux> most people here -_-
<infoe> big bang theory is awesome
ygrek has joined #ocaml
jimmyb2187 has joined #ocaml
<mrvn> I want that toaster,
seanmcl has joined #ocaml
<Alpounet> Camarade_Tux, haha !
ygrek has quit [Remote closed the connection]
Submarine has quit [Remote closed the connection]
waleee has quit ["leaving"]
Submarine has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
_unK has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
seanmcl has quit []
BiDOrD has quit [Read error: 110 (Connection timed out)]
eldragon has left #ocaml []
lutter has joined #ocaml
ttamttam has quit ["Leaving."]
_zack has quit ["Leaving."]
jimmyb2187 has quit [Read error: 60 (Operation timed out)]
eldragon has joined #ocaml
BigJ has joined #ocaml
jimmyb2187 has joined #ocaml
palomer_ has joined #ocaml
<palomer_> I'm trying to follow the ocamlyacc manual. when I try to ocamlc a file I generated with ocamlyacc it gives me the error: Error: Could not find the .cmi file for interface rpcalc.mli.
Yoric has quit [Remote closed the connection]
<flux> palomer_, compile the .mli-file first..
<palomer_> ahh, righto
<palomer_> didn't see that it also generated a mli file
seanmcl has joined #ocaml
ikaros has joined #ocaml
eldragon has left #ocaml []
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
brendan__ is now known as rbendan
rbendan is now known as br3endan
br3endan is now known as brendan
atol has joined #ocaml
<atol> Is it possible to read a web page in ocaml ?
mishok13 has quit [Read error: 110 (Connection timed out)]
<Camarade_Tux> yes
<Camarade_Tux> and what do you mean exactly with "read"?
<atol> Import the html
<atol> I want to import a wikisource page and read line by line the text
<mrvn> With html line by line makes no sense.
<Camarade_Tux> well, as a tree, find the proper element and start reading?
<atol> Yes
r0bby has quit [Read error: 104 (Connection reset by peer)]
<atol> my main problem is to find how import the entire page
r0bby_ has joined #ocaml
<atol> I think after i can easily filter what i want
<mrvn> wget url | ocaml-prog
<mrvn> wget -O - url | ocaml-prog
<atol> No but i need to be able to do it inside the programme and not with shell command
<mrvn> I wouldn't write a html downloader (preferably using libcurl or something) unless you need to follow links in your ocaml code.
<Camarade_Tux> there are curl binding, there is ocamlnet, and there are other ways
<Camarade_Tux> you could open a connection and then just ask for the page, can't tell more right now unfortunaltey
<Camarade_Tux> *unfortunately
tmaeda is now known as tmaedaZ
tmaedaZ is now known as tmaeda
smimou has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
<atol> Is there a function that can stop for a limited time the execution like pause in c ?
<flux> Unix.sleep
ulfdoz has joined #ocaml
<mrvn> Unix.sleep
<flux> oh, like pause..
<flux> actually I don't know about that. perhaps you can use Unix.select
<flux> but I suppose Unix.sleep will work too, if you want an upper bound limit
<mrvn> sleep(max_int)?
<Camarade_Tux> Unix.sleep is for seconds though (but you can easily write a binding to nanosleep() or usleep())
<mrvn> a select with no timeout will be like pause.
<flux> camarade_tux, or you can use Unix.select..
<atol> Reference to undefined global `Unix'
<atol> > Terminated with exit code 2.
<mrvn> needs unix.cmx
<flux> unix.cmxa or unix.cma you mean
<mrvn> yes
<Camarade_Tux> flux: I had a problem with select once, can't remember what though
<Camarade_Tux> and binding C was muuuch easier :)
<flux> one think I dislike about Unix.select is its timeout parameter
<flux> it's not an option type!
<flux> hey, batteries is in position to fix that.. ;)
tmaeda is now known as tmaedaZ
Mr_Awesome has joined #ocaml
<mrvn> flux: -1. works as None.
<flux> mrvn, yes, but it's not pretty :)
<flux> mrvn, for example if I'm calculating time deltas
<flux> mrvn, if it happens that the value is negative, I'm stuck waiting forever
<flux> unless I remember to check that condition beforehand
<mrvn> yeah.
<flux> of course, it's never happened to me, but it could happen, and we _do_ have an excellent option type for exactly these kinds of situations :)
<mrvn> It also sucks that C select does not reliably return the time remaining.
<mrvn> select sucks anyway. epoll() rules.
<flux> select stays, the daily cool replacement of it dies :)
<flux> I suppose you can always use a library that supports all those
<flux> like libev
<flux> but my bindings for it don't work, argggh, and I don't know why :)
<mrvn> flux: select takes O(n) time, with the wrapper converting FD lists into bit sets that is substantial.
<flux> (random gc-related crashes)
<mrvn> and no level/edge trigger destinction.
<flux> (but libev is otherwise pretty cool)
<mrvn> flux: forgot to register a root or some data structure in the GC heap the libev references after the GC moved it?
<flux> that's just it, I'm pretty sure I do all that
<flux> but it's been some time since I've touched it, though
BigJ has quit ["Leaving"]
<flux> apparently I found something related to it (adding objects to a global hash table made crashes go away)
albacker has joined #ocaml
<mrvn> That indicates a missing root
<flux> in any case, here were the bindings: http://modeemi.fi/~flux/software/ocaml-ev/
ttamttam has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
<flux> apparently I even bothered to write self-contained documentation for it atoo :-o
<flux> (that is, ocamldoc documentation)
<flux> (with links to original documentation)
BigJ has joined #ocaml
BigJ2 has joined #ocaml
fschwidom has joined #ocaml
ikaros has joined #ocaml
_andre has quit ["Lost terminal"]
BigJ has quit ["Leaving"]
BigJ has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
BigJ has quit [Remote closed the connection]
ygrek has joined #ocaml
fschwidom has quit [Remote closed the connection]
ttamttam has quit ["Leaving."]
BigJ has joined #ocaml
onigiri has joined #ocaml
julm_ has joined #ocaml
seanmcl has quit []
seanmcl has joined #ocaml
BigJ has quit ["Leaving"]
_zack has joined #ocaml
julm has quit [Nick collision from services.]
julm_ is now known as julm
BigJ2 has quit [Read error: 60 (Operation timed out)]
mfp has quit [Read error: 110 (Connection timed out)]
mfp has joined #ocaml
sramsay has joined #ocaml
julm_ has joined #ocaml
_JusSx_ has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
kaustuv has joined #ocaml
_unK has quit [Remote closed the connection]
Snark_ has quit ["Ex-Chat"]
julm_ is now known as julm
palomer has quit ["Leaving"]
itewsh has joined #ocaml
albacker has quit ["Leaving"]
palomer_ has quit [Remote closed the connection]
ofaurax has joined #ocaml
_zack has quit ["Leaving."]
ulfdoz has quit [Read error: 110 (Connection timed out)]
BigJ2 has joined #ocaml
BigJ2 has quit [Client Quit]
seanmcl has quit []
ygrek has quit [Remote closed the connection]
_JusSx_ has quit ["leaving"]
rwmjones_lptp has joined #ocaml
eldragon has joined #ocaml
sramsay has quit [Remote closed the connection]
ikaros has quit ["Leave the magic to Houdini"]
itewsh has quit [Read error: 113 (No route to host)]
palomer has joined #ocaml
<palomer> %type <exp> input <--- Error: Unbound type constructor exp , how do I fix this?
ztfw has quit [Remote closed the connection]
jonafan has quit ["Leaving"]
rwmjones_lptp has quit ["This computer has gone to sleep"]
tmaedaZ is now known as tmaeda
ofaurax has quit [Read error: 60 (Operation timed out)]
seanmcl has joined #ocaml