flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
dsheets has quit [Ping timeout: 256 seconds]
eikke has quit [Ping timeout: 264 seconds]
eikke has joined #ocaml
milosn_ is now known as milosn
eikke has quit [Ping timeout: 248 seconds]
eikke has joined #ocaml
Neros has quit [Ping timeout: 252 seconds]
tane has quit [Quit: Verlassend]
darkf has joined #ocaml
walter|r has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
eikke has quit [Ping timeout: 246 seconds]
eni has quit [Quit: Leaving]
ski has joined #ocaml
tobiasBora has quit [Quit: Konversation terminated!]
eikke has joined #ocaml
ontologiae_ has joined #ocaml
daydreamt has left #ocaml []
foones has joined #ocaml
foones has quit [Quit: ""]
ontologiae_ has quit [Ping timeout: 256 seconds]
the-manless-man has joined #ocaml
eikke has quit [Ping timeout: 245 seconds]
Watcher7 is now known as Watcher7|off
emmanuelux has quit [Ping timeout: 256 seconds]
the-manless-man has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
walter|r has quit [Quit: This computer has gone to sleep]
Drup has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 246 seconds]
osnr has quit [Ping timeout: 246 seconds]
asmanur has quit [Ping timeout: 256 seconds]
asmanur has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
mal`` has quit [Ping timeout: 246 seconds]
mal`` has joined #ocaml
osnr1 has joined #ocaml
osnr has quit [Ping timeout: 252 seconds]
NaCl_ has joined #ocaml
NaCl_ has quit [Changing host]
NaCl_ has joined #ocaml
ia0_ has joined #ocaml
cthuluh_ has joined #ocaml
NaCl has quit [Remote host closed the connection]
cthuluh has quit [Remote host closed the connection]
ia0 has quit [Write error: Connection reset by peer]
malc__ has joined #ocaml
ttamttam has joined #ocaml
cthuluh_ is now known as cthuluh
ttamttam has quit [Quit: ttamttam]
Watcher7|off is now known as Watcher7
Snark has joined #ocaml
yacks has quit [Quit: Leaving]
LiesHidden has joined #ocaml
<LiesHidden> Awesome, an OCaml room :D
<darkf> yep
<LiesHidden> I've worked out solutions for several Project Euler problems using OCaml, but they tend to be (semi) brute force solutions. And I'm stumped on a few, like problem 61. It's a fun language, outside of the library.
ygrek has joined #ocaml
Watcher7 is now known as Watcher7|off
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr1 has quit [Ping timeout: 248 seconds]
<adrien> try javascript: you'll enjoy the ocaml stdlib :P
LiesHidden has quit [Ping timeout: 246 seconds]
malc__ has quit [Quit: Lost terminal]
ttamttam has joined #ocaml
Arsenik has joined #ocaml
<gasche> gildor: I'm trying to get the oasis sources following the instructions on the webpage http://oasis.forge.ocamlcore.org/contribute.html , and that does not work
<gasche> the darcs repository seems not to exist, and the "project" and "website" links return an error page
<gasche> ( reason: I have just been bitten by https://forge.ocamlcore.org/tracker/?func=detail&atid=291&aid=1236&group_id=54 and wanted to see if it was easy to fix )
eni has joined #ocaml
osnr1 has joined #ocaml
osnr has quit [Ping timeout: 252 seconds]
osnr1 has quit [Ping timeout: 246 seconds]
<gasche> gildor: while I'm here pinging you
<gasche> (1) I also encountered the issue of not knowing how to put a dash in library names (answer: quote it), and woud appreciate if the parser accepted that without quotes
<gasche> (2) I think oasis should integrate features from dbunzli's http://erratique.ch/repos/xmlm/tree/build
<quelu> join #ocsigen
<gasche> (it's a script that starts from a development repository with only an _oasis file, calls oasis to produce the right setup.ml and generated files and makes a tarball out of it; so you can easily produce release tarballs that do not depend on oasis, while simultaneously keeping a maximally clean development repository)
<gasche> that could be provided by oasis as an "oasis release" command that would do this for us
rwmjones has quit [Ping timeout: 240 seconds]
<gasche> it also uses the oasis meta-data to set/replace some variables in his home-edited README file; this could be useful as well (but optional)
<gasche> finally, there is some logic to update his website, that probably doesn't make much sense in a reuse ocntext
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
tane has joined #ocaml
<gasche> def-lkb: it would be nice if merlin could deduce its .merlin information from OASIS files
<adrien> it's fairly annoying to have half a dozen incompatible file formats which state the same; a tool to output JSON/XML from them would probably be pretty nice
<gasche> currently there is an overlap between .typerex, _oasis, .merlin and buildsystem-specific files (_tags, but I assume also stuff from ocp-build etc.)
osnr1 has joined #ocaml
<gasche> I think _oasis is in a reasonable position to be an upper bound of these
osnr has quit [Ping timeout: 252 seconds]
<gasche> (augmented with buildsystem-specific knowledge of the build system metadata)
<adrien> well, it's supposed to cover everything so, probably
<adrien> reminds me I have to try ocp-build
<adrien> (I've never understood how there could be no "#include" directive in HTML)
<gasche> my understanding of oasis is that it's the tool that knows what the expected layout is to distribute OCaml libraries at some point in time
<gasche> I don't want to know about when .cmxs are necessary or not, and am happy delegating that knowledge to a tool to which I just say "I want to distribute this as a library, please"
<gasche> (the build system being the one that knows *how* to build this stuff)
<gasche> anyway
<gasche> an _oasis file has Executable and Library sections with a BuildDepends field listing the findlib packages it depends on (exactly what merlin's PKG needs), and which build system is used (from which merlin could deduce the B information about where compiled files are located)
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr1 has quit [Read error: Connection reset by peer]
ollehar has joined #ocaml
rwmjones has joined #ocaml
UncleVasya has joined #ocaml
<asmanur> gasche: and S ?
osnr1 has joined #ocaml
<gasche> asmanur: I'm not quite sure
osnr has quit [Ping timeout: 246 seconds]
<gasche> the "path" metadata of oasis gives a rough approximation
<gasche> you could also run the build command, and see what the build system inspected (but that's fragile and not good)
<gasche> I think the best think to do would be to ask each buildsystem where it consider the sources may live
<gasche> in ocamlbuild, that corresponds to the "traverse" information
ggole has joined #ocaml
<gasche> but then we should add a feature to ocamlbuild to be able to query this information
<gasche> (something like -documentation, but for traverse)
<gasche> s/think/thing/
<gasche> asmanur: what do you think?
<gasche> another impedance mismatch between .merlin and oasis is the fact that oasis may have different build metadata per Library/Executable section
<asmanur> gasche: it may work
<asmanur> yes
<gasche> but I think taking the union of this information should be satisfying
<asmanur> at some point we discussed to possibility of having different merlin instances for files in different project
osnr1 has quit [Ping timeout: 252 seconds]
<asmanur> perhaps parsing the oasis file would be an easy way to determine which file has to go in which instance
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<gasche> I'm working right now on something pretty fun
<gasche> in order to test the printf/scanf/format patch of Benoît Vaugon, I'm trying to write a fuzzer for formats
<gasche> not finished yet, but I expect the results to be interesting
<asmanur> a fuzzer ?
<gasche> for format strings
<asmanur> you mean something that generates randomly formats ?
<gasche> ys
<asmanur> how do you deal with types ?
<gasche> just generate the format string and check that string_of_format is what you expect
<gasche> I'm not planning to exercize the printf/scanf/format code yet
yacks has joined #ocaml
<gasche> even with only that, the problem is that I know the two impl. will behave differently in quite a few case (because Benoît rejects more format strings statically)
<gasche> so it will not be trivial to get some information about diverging behaviors, without too much noise about behaviors that I know diverge
ontologiae_ has joined #ocaml
<asmanur> i can imagine :)
<asmanur> but if you're testing only if the parser fails or suceeds, what do you want to check?
eni has quit [Ping timeout: 256 seconds]
<gasche> asmanur: when you call string_of_format, Benoît's implementation reconstruct the format string from the GADT value
<ollehar> if modules are first-class in OCaml, why can't I pass a signature as an argument to a function?
<gasche> ollehar: first-class modules allow you to lift stuff from the module language to the term language
<gasche> the module language doesn't have abstraction on signatures
<asmanur> gasche: oh so now format is not an abstract alias for string ?
<gasche> asmanur: look at the bugtracker discussion
<gasche> (for me it's food market time, afk)
eni has joined #ocaml
zarul has quit [Ping timeout: 256 seconds]
jbrown has joined #ocaml
dsheets has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
ygrek has quit [Ping timeout: 248 seconds]
<Anarchos> in otherlibs/systhreads, what is the purpose of the caml_thread_tick ?
<gasche> Anarchos: in st_posix.h: "/* The tick thread: posts a SIGPREEMPTION signal periodically */
<Anarchos> gasche yes i saw it, but when my second thread calls caml_c_thread_register, it launches this caml_thread_tick. Then it tries to acquire the lock through caml_acquire_runtime_system, which tries to execute the handler of SIGVTALRM. And caml_signal_handlers is null in this second thread...
<gasche> I don't know anything about this stuff
<gasche> again, you should consider asking on the caml-list
<gasche> Xavier, Gerd, Goswin may be able to answer this
<gasche> s/this/your questions on signals/
<gasche> Jérémie also
<Anarchos> gasche i don't want to disturb Xavier with silly questions on an unsupported architecture...
<gasche> they will choose whether or not to pay attention to your question
ontologiae_ has quit [Ping timeout: 256 seconds]
<adrien> and as long as you're aware the issue might lie with your architecture, that should be fine
q66 has joined #ocaml
ontologiae_ has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
osnr1 has joined #ocaml
osnr has quit [Read error: Connection reset by peer]
ontologiae_ has quit [Ping timeout: 246 seconds]
eikke has joined #ocaml
beckerb has joined #ocaml
raichoo has joined #ocaml
UncleVasya has quit [Read error: Connection reset by peer]
ontologiae_ has joined #ocaml
eni is now known as albacker
albacker has quit [Changing host]
albacker has joined #ocaml
albacker is now known as eni
Yoric has joined #ocaml
speredenn has joined #ocaml
eikke has quit [Ping timeout: 240 seconds]
talzeus has joined #ocaml
ohama has quit [Remote host closed the connection]
ohama has joined #ocaml
t4nk703 has joined #ocaml
<t4nk703> hi, is there a python's dir() command equivalent in ocaml? For example, how would one see all the available methods of under the String module (ie. String.length, String.sub, etc)
eikke has joined #ocaml
raichoo has quit [Ping timeout: 264 seconds]
Neros has joined #ocaml
<ggole> A common trick is to type module S = String into a toplevel
raichoo has joined #ocaml
raichoo has quit [Client Quit]
raichoo has joined #ocaml
<t4nk703> thats nice. thanks!
<gasche> hah! first potential bug found through format fuzzing
<gasche> t4nk703: if you use either Emacs or Vim, you should try merlin (google 'merlin ocaml'); its an editor mode that does completion on String. etc.
<gasche> # string_of_format "%Lld";;
<gasche> - : string = "%Nld"
<t4nk703> ok thanks
ontologiae_ has quit [Ping timeout: 252 seconds]
raichoo has quit [Ping timeout: 240 seconds]
raichoo has joined #ocaml
eni has quit [Read error: Connection reset by peer]
cdidd has quit [Remote host closed the connection]
<t4nk703> trying to figure out how to reverse a string in a functional way but the following is giving me a syntax error in the "else if" part: let rec swap s i j = if i < j then (String.sub s j 1)^(swap s (i+1) (j-1))^(String.sub s i 1) else if i = j then (String sub s i 1) else ""
<t4nk703> any pointers?
<gasche> t4nk703: if you use String.sub, you're doomed.
<gasche> arrays and strings are mutable data structures, there is no point trying to be functional with them
<gasche> write a for loop as you would expect (did you know about "for i = 10 downto 0 do" ?)
<t4nk703> o haha ok
<gasche> string concatenation a^b takes time in memory linear in the sum of the length of a and b
<t4nk703> yes, well im aware that it exists
<gasche> this mean that a recursive algorithm calling (^) at each step will have quadratic complexity or worse
<t4nk703> ok ic
Drup has joined #ocaml
Neros has quit [Remote host closed the connection]
ttamttam has left #ocaml []
Neros has joined #ocaml
ulfdoz has joined #ocaml
walter|r has joined #ocaml
<t4nk703> gasche: how does the complexity of reversing an array of integers using a for loop compare to that of reversing a list of integers in a functional style (ie. calling repeatedly (reverse [tail of list]) :: head)
<gasche> t4nk703: that's not how you reverse a list in functional style
<gasche> what you wrote is quadratic and wrong, the right version is linear
<gasche> (wrong because it has the wrong complexity; it returns the correct result)
<gasche> t4nk703: to write List.rev, you should first write List.rev_append
<gasche> List.rev_append [1;2;3] [4;5;6] is [3;2;1;4;5;6]
<gasche> then you will be enlightened, if you allow this koan-esque style
<gasche> (and to answer your actual question: both array reversal and list reversal are linear)
eikke has quit [Ping timeout: 246 seconds]
<t4nk703> ic ok, thanks
NaCl_ is now known as NaCl
Anarchos has joined #ocaml
beckerb has quit [Quit: Konversation terminated!]
talzeus has quit [Remote host closed the connection]
ygrek has joined #ocaml
Nahra has quit [Quit: leaving]
Nahra has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
ulfdoz has quit [Ping timeout: 264 seconds]
<ggole> Reversing an array of integers is usually unnecessary, though
ulfdoz has joined #ocaml
emmanuelux has joined #ocaml
ggherdov has quit [Ping timeout: 264 seconds]
ontologiae_ has joined #ocaml
Nahra has quit [Quit: leaving]
<Anarchos> ggole an array ?? Just use j=(size array)-i as index:)
Nahra has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
<ggole> I was commenting on t4nk703's question about complexity
<ggole> Often arrays don't merely provide a faster operation than lists, but let you not require the operation at all
<ggole> Although the stdlib has precious little to take advantage of subsequences :/
raichoo has quit [Ping timeout: 246 seconds]
yacks has quit [Remote host closed the connection]
cross_ has joined #ocaml
noj_ has joined #ocaml
alxbl_ has joined #ocaml
nicoo_ has joined #ocaml
patronus has joined #ocaml
speredenn has quit [Quit: Leaving]
ttm has joined #ocaml
deavidsedice has joined #ocaml
walter|r has quit [Quit: This computer has gone to sleep]
kaktus__ has joined #ocaml
Nahra has quit [*.net *.split]
ontologiae_ has quit [*.net *.split]
Watcher7|off has quit [*.net *.split]
lopex has quit [*.net *.split]
kaktus has quit [*.net *.split]
The_third_man has quit [*.net *.split]
cross has quit [*.net *.split]
deavid has quit [*.net *.split]
alxbl has quit [*.net *.split]
patronus_ has quit [*.net *.split]
noj has quit [*.net *.split]
nicoo has quit [*.net *.split]
alxbl_ is now known as alxbl
Arsenik has quit [Remote host closed the connection]
Cyanure has joined #ocaml
darkf has quit [Quit: Leaving]
speredenn has joined #ocaml
Watcher7|off has joined #ocaml
ontologiae_ has joined #ocaml
lopex has joined #ocaml
ygrek has quit [Ping timeout: 252 seconds]
walter|r has joined #ocaml
ggherdov has joined #ocaml
oriba has joined #ocaml
Nahra has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
ontologiae_ has quit [Ping timeout: 252 seconds]
<oriba> is lablgtk outdated? is lablgtk2 up-to-date/state-of-the-art ??
Kakadu has joined #ocaml
cokesme has joined #ocaml
<adrien> hmm?
<adrien> wrt what?
Nahra has quit [Quit: leaving]
LiesHidden has joined #ocaml
ttamttam has joined #ocaml
Nahra has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
Kakadu has quit []
eni has joined #ocaml
<Anarchos> It seems that if C threads use callback to ocaml and use the caml_c_thread_register(), i have to compile with -linkall in order to get the init part of otherlib/systhreads/thread.ml (the "let _ = .." part of thread.ml) executed in my application. Is it known ?
kaktus__ is now known as kaktus
Cyanure has quit [Remote host closed the connection]
Watcher7|off is now known as Watcher7
Neros has quit [Remote host closed the connection]
Snark has quit [Quit: leaving]
Neros has joined #ocaml
zpe has joined #ocaml
<companion_cube> gasche: which loop?
<gasche> companion_cube: which loop what?
<gasche> ah
<gasche> in the loop
<gasche> rgrinberg was considering adding sexp_of and of_sexp functions in batteries
<gasche> that seemed related to your recent Bidir work
<gasche> (but I couldn't find again bidir on your github homepage, where is it?)
<gasche> I've been trying to coerce you into contributing something to batteries for the last few months
<gasche> that may be an opportunity
<companion_cube> (it's Bij, not bidir)
<companion_cube> i've been talking about this with thelema, but he didn't seem too interested :p
ttamttam has quit [Remote host closed the connection]
<Anarchos> gasche i solved my threads problem (just read my previous message)
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
osnr1 has quit [Quit: Leaving.]
oriba has quit [Quit: oriba]
sgnb has quit [Remote host closed the connection]
sgnb has joined #ocaml
nicoo_ is now known as nicoo
eni has quit [Ping timeout: 246 seconds]
<rgrinberg> Yes I've been cheating on batteries with core lately, and I have to say that core does many things more right
<rgrinberg> sexp being one of them
<rgrinberg> but batteries has its advantages as well
<rgrinberg> companion_cube: are you still planning on including your sequence library in batteries?
<companion_cube> oh
<companion_cube> there already is Enum
<companion_cube> which is more powerful...
<rgrinberg> but slower, right?
<companion_cube> for enumeration over big sequences, probably
<companion_cube> well, I have a unit -> (unit -> 'a) abstraction which is more flexible than Sequence
<companion_cube> but thelema is working on something similar afaik
<rgrinberg> btw, the opam version of sequence doesn't have Sequence.from_fun which is in the online docs
<rgrinberg> so the opam version is a little old probably
<companion_cube> right
<companion_cube> maybe i should make a minor release
<rgrinberg> it is a pretty useful function ;)
<companion_cube> do you use Sequence, then? :)
<rgrinberg> companion_cube: I do usually when I don't want to take a dependency on batteries
<rgrinberg> especially with core
<rgrinberg> since this is the part where core is kind of weak
<companion_cube> yeah,ok
Watcher7 is now known as Watcher7|off
emmanuelux has quit [Ping timeout: 264 seconds]
eikke has joined #ocaml
emmanuelux has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
emmanuelux has quit [Max SendQ exceeded]
emmanuelux has joined #ocaml
<LiesHidden> Has anyone successfully coded a Miller-Rabin primality test in OCaml?
oriba has joined #ocaml
cdidd has joined #ocaml
Neros has quit [Read error: Connection reset by peer]
Nahra_ has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
Nahra has quit [Quit: Lost terminal]
Nahra_ has quit [Client Quit]
Neros has joined #ocaml
ggole has quit []
Nahra has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
<LiesHidden> I think I just cracked that nut :D
<companion_cube> time to opam-ize your code :p
<LiesHidden> oh, it is pretty optimized already ;) takes about 50 ms, not compiled. If I find a large enough prime to test, I'll have a better sample.
<LiesHidden> Hmm.. actually just did, lol and it slows it down IMMENSELY... time to optimize
<thizanne> he said opam-ize, not optimize ;)
<LiesHidden> *chuckles* yeah, I just noticed that.
<companion_cube> :)
<LiesHidden> Hmm.. a huge 8-digit prime took 2m 5s :/
<LiesHidden> Well, not huge, lol, considering they've found primes with millions of digits.
Neros has quit [Read error: Connection reset by peer]
Neros has joined #ocaml
speredenn has quit [Quit: Leaving]
<LiesHidden> Hmm... is Nums more efficient than Int64?
<companion_cube> I don't think so
<companion_cube> but if you want efficient big ints, try zarith
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<LiesHidden> Hmm there's an idea. Of course, 2m is much better than generating a list of primes with a sieve and using List.exists for an is_prime function, but I'd love to get it to within a few seconds for 8-digit primes.
zpe has quit [Remote host closed the connection]
<companion_cube> with a sieve you would want a stream/lazy list, would'nt you?
<LiesHidden> That would help, but generating primes up to 100M, still takes a long time, lazily or otherwise.
osnr has quit [Ping timeout: 240 seconds]
<LiesHidden> At least, when using a sieve lol
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<rzm> Hello everyone. I'd like to learn OCaml as my first functional language. Are there any books you'd recommend?
<companion_cube> there are also approximate primary tests
<companion_cube> rzm: hi
<rzm> companion_cube: hey
<companion_cube> I couldn't recommend one in particular, though
<rzm> I've seen this list actually, but is there a particular recommendation for someone with no functional background at all?
<LiesHidden> I'm working on a Project Euler problem, though, so, I'm not sure approximation would be a good idea
<companion_cube> rzm: I think any of those books will show you ideas from the functional realm
<companion_cube> although ocaml also has imperative features
<LiesHidden> Sadly, every time I try to use the imperative features, I always fail, lol, I tend to make anything I need loops for into recursions, and use shadowing when I need to change a value.
<Drup> rzm: what language(s) do you usually use ?
<companion_cube> LiesHidden: hashtables are very nice
Zeev has quit [Disconnected by services]
Zeev has joined #ocaml
<companion_cube> especially their backtracking behavior
<LiesHidden> Haven't had an opportunity to use them yet, but they do look useful
<rzm> Drup: C, Perl and lately Go
<Drup> that's indeed not very functional.
<rzm> which is why I decided to learn OCaml :)
jbrown has quit [Ping timeout: 240 seconds]
walter|r has quit [Quit: This computer has gone to sleep]
zpe has joined #ocaml
<rgrinberg> has anyone noticed the OCaml ecosystem grow in the last few years?
<rgrinberg> I feel as though there shuold be more growth given all the nice things that's been hapenning
zpe has quit [Ping timeout: 276 seconds]
ollehar has quit [Ping timeout: 252 seconds]
Drup has quit [Quit: Leaving.]
tane has quit [Quit: Verlassend]
zpe has joined #ocaml
zpe has quit [Ping timeout: 276 seconds]
eikke has quit [Ping timeout: 252 seconds]
eikke has joined #ocaml
zpe has joined #ocaml
ollehar has joined #ocaml
<LiesHidden> Hmm anyone know the optimum number of iterations for a Miller-Rabin prime test?
zpe has quit [Ping timeout: 240 seconds]