claudiuc has quit [Remote host closed the connection]
Simn has quit [Quit: Leaving]
boogie has quit [Remote host closed the connection]
reem_ has quit [Remote host closed the connection]
Guest65209 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
prsn has quit [Ping timeout: 240 seconds]
reem has joined #ocaml
prsn has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
AltGr has joined #ocaml
flux has joined #ocaml
reem has quit [Remote host closed the connection]
TheLemonMan has quit [Quit: leaving]
MrScout has quit [Remote host closed the connection]
reem has joined #ocaml
madroach has quit [Ping timeout: 240 seconds]
madroach has joined #ocaml
prsn has quit [Ping timeout: 272 seconds]
prsn has joined #ocaml
jprakash has quit [Ping timeout: 272 seconds]
shinnya has quit [Ping timeout: 255 seconds]
prsn has quit [Ping timeout: 250 seconds]
prsn has joined #ocaml
kakadu has joined #ocaml
Algebr has joined #ocaml
<Algebr>
It seems that it is possible to add new directives to the toplevel at will, is this some magic that is exposed via compiler-libs?
<dmbaturin>
Algebr: There's a way to create custom toplevels, but it doesn't provide facilities for defining new directives AFAIR.
rgrinberg has joined #ocaml
prsn has quit [Ping timeout: 245 seconds]
<Algebr>
But #require is not part of the original ocaml toplevel but it works in tuop which uses findlib I assume. So it must have added it somehow?
<Algebr>
utop
prsn has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
<dmbaturin>
Algebr: Hhm, there must be a way to do it. Apparently, the require directive comes from findlib, because "#use "topfind";; #require "something"" works.
darkf has joined #ocaml
ghostpl_ has joined #ocaml
yminsky has joined #ocaml
prsn has quit [Ping timeout: 244 seconds]
rgrinberg has joined #ocaml
prsn has joined #ocaml
ghostpl_ has quit [Ping timeout: 244 seconds]
thomasga has quit [Quit: Leaving.]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
marynate has joined #ocaml
<dmbaturin>
Algebr: Reading findlib source revealed that the toplevel stores directive callbacks in a hashtbl and that you can modify it.
<Algebr>
yea, I found it too, the Toploop.directive_table
<dmbaturin>
Did you succeed at modifying it?
<Algebr>
I haven't added anything to it, but it is a plain ole' hashtable so it should be possible. Looking at utop, it adds quite a bit of stuff as well
rgrinberg has quit [Ping timeout: 264 seconds]
<SGrondin>
Anybody here has some experience with ctypes?
prsn has quit [Ping timeout: 264 seconds]
prsn has joined #ocaml
<SGrondin>
let hw = foreign "helloworld" (void @-> returning void)
<Algebr>
I guess there is no math module, so all math that comes with ocaml is just dumped in Pervasives?
<whitequark>
you need #directory "+compiler-libs";;
<whitequark>
Algebr: some is in Int64
<Algebr>
whitequark: thanks, also what is the + for ?
shinnya has quit [Ping timeout: 265 seconds]
<dmbaturin>
whitequark: Ah, thanks, now it works. Some time I'm going to figure out what exactly the awkward ways it interacts with toplevel are.
<Algebr>
Oh derp, it probably just means add right? is there a - as well?
<Algebr>
I wrote a recursive function to find pi with a given tolerance of epsilon_float, which I understand is the smallest float that the machine can reliably deal with , but the function finishes in just 4 iterations...which is kind of suspect. Is there some kind of BigFloat I can use to get even more precision? I'm only getting these many digits: 3.14159265359
<bernardofpc>
Algebr: what is your algorithm like ?
<Drup>
" type _ sexp = Sexp_atom : 'a atom -> 'b atom sexp "
<Drup>
I'm pretty sure you want "Sexp_atom : 'a atom -> 'a atom sexp "
<Drup>
the issue here is that, with this definition, given a "Sexp_atom foo" you have no idea what the type of foo is
<Drup>
(that's what the error message is saying, the type of foo is not known, hence you can't return it to the external word)
<jprakash>
hmm but I want to make lists like [Sexp_atom (Abool true); Sexp_atom (Aint 3)] and couldn't do that with 'a atom -> 'a atom sexp
<Drup>
I see, you want an heterogeneous list.
<Drup>
1) don't put an unbound variable then, just do "type sexp = Sexp_value : 'a atom -> sexp"
<haesbaert>
Drup: I still don't get it, ksprintf wants a function that takes a string, and a format, it then formats the string and applies the function to it
<Drup>
2) You just discovered existential types, all my condolences :D
<haesbaert>
I'd then, expect this to work: let myprintf p fmt = if p then ksprintf print fmt else ()
<haesbaert>
I'm trying to get it without Lwt as you suggested
myst|work has quit [Ping timeout: 256 seconds]
<whitequark>
haesbaert: ksprintf is basically continuation passing style printf
<Drup>
do you know what the *s* is for in ksprintf ?
<whitequark>
sprintf*
<haesbaert>
whitequark: continuation passing style being ?
<haesbaert>
Drup: I guess string
<haesbaert>
as the doco says it is "the same as sprintf"
<Drup>
not really, it's explained in printf I think
<whitequark>
oh. well then it's not an explanation that's going to help you
<Drup>
err
<haesbaert>
seriously I'm finding the documentation beyond horrible
<Drup>
how fuck, I'm sorry, I meant ifprintf, not k >_>
<haesbaert>
in my case ikfprintf I assume ?
<Drup>
so basically, the goal is to use the normal variation if verbose is on and the *i* version if verbose if off
<haesbaert>
ohhhhh
<Drup>
kprintf is the father of all the printfs, all the other are implemented with it
shinnya has quit [Ping timeout: 256 seconds]
<Drup>
(hence you can implement all the i versions with ikprintf)
<Drup>
ikf*
<jprakash>
Drup: still getting the same error
<Drup>
jprakash: sure, that's normal, you are still trying to do something untyped.
ghostpl_ has joined #ocaml
<haesbaert>
Drup: ack now I got it.
<haesbaert>
but seriously, is there a policy of not putting any kind of examples in the manual, or of giving small, almost cryptic explanations of it ?
<Drup>
I prefer not to answer that :<
myst|work has joined #ocaml
<haesbaert>
or is it just the fact that I'm a beginner, cause seriously it seems to be designed to make new users walk away sometimes.
<Drup>
no, you are absolutely right.
<haesbaert>
ack, nice to know I'm not insane \o/
prsn has quit [Ping timeout: 245 seconds]
<Drup>
jprakash: so, the issue is that what you are trying to do will not work as it.
MercurialAlchemi has quit [Ping timeout: 244 seconds]
MercurialAlchemi has joined #ocaml
<jprakash>
because foo in Sexp_atom foo could be anything?
<Drup>
once you put something in the existential (that's your sexp type), you "forget" the type information, and you can't get them back. This means that you can open the existential box, you can play with it, but you can't return it or use it's specific type.
psy_ has quit [Ping timeout: 244 seconds]
<Drup>
it would be in 'a atom, yes
<Drup>
could*
prsn has joined #ocaml
<Drup>
any*
c74d has quit [Remote host closed the connection]
dsheets has quit [Quit: Leaving]
<jprakash>
how/why do you use existential types if you can't get what you put into it out
<Drup>
it doesn't mean you can't do what you want, just not this way.
<Drup>
well, it's occasionally very useful.
<Drup>
you can get what you put into it. You just can't return it.
dsheets has joined #ocaml
tg has quit [Ping timeout: 244 seconds]
<Drup>
imagine you have a print_atom function
<Drup>
you can perfectly do "let print_of_sexp (Sexp_atom a) = print_atom a"
<Drup>
because it doesn't return the type of a.
ghostpl_ has quit [Ping timeout: 272 seconds]
<jprakash>
I see
thomasga has joined #ocaml
_5kg has quit [Ping timeout: 246 seconds]
c74d has joined #ocaml
psy_ has joined #ocaml
<Drup>
Of course, if you actually pattern match foo, you will know the type.
mort___ has joined #ocaml
psy_ has quit [Max SendQ exceeded]
psy_ has joined #ocaml
psy_ has quit [Max SendQ exceeded]
paradoja has joined #ocaml
TheLemonMan has quit [Quit: leaving]
<jprakash>
I don't understand why I can do (Sexp_value (Abool b)) -> string_of_bool b
<jprakash>
but not (Sexp_value (Abool b)) -> Bool b
tg has joined #ocaml
<jprakash>
I mean, both string_of_bool and Bool require that type information about b that was "forgotten", right?
matason has quit [Ping timeout: 265 seconds]
<Drup>
what's the error with the second ?
rgrinberg has joined #ocaml
<jprakash>
oh sorry I can do that. But I can't do it with (Sexp_value (Aint i)) -> Int i also in the function
beginner has quit [Ping timeout: 252 seconds]
<Drup>
yes
<Drup>
that's because you fix the output type (by saying it's a bool)
<jprakash>
yes
<jprakash>
how do I avoid that
beginner has joined #ocaml
beginner has joined #ocaml
<jprakash>
can I?
<Drup>
not if you want to put all the elements in the same list.
<Drup>
you have to choose, you can't do both :)
dav has quit [Quit: leaving]
<jprakash>
:(
prsn has quit [Ping timeout: 240 seconds]
<Drup>
(well, you can add more layers, of course)
prsn has joined #ocaml
paradoja has quit [Ping timeout: 265 seconds]
paradoja has joined #ocaml
maurer has quit [Remote host closed the connection]
maurer has joined #ocaml
<dmbaturin>
I still find socket multiplexing with Lwt puzzling. What is the correct way to do it?
<dmbaturin>
Lwt.async returns unit rather than Lwt.t, so I can't use bind with Lwt_unix.accept in it.
<Drup>
I'm not sure to see your issue
<dmbaturin>
Drup: Well, I want to accept connections and keep reading from them and handling received data. As I understand, using Lwt.async with a callback parameterized by file descriptor would do what I want, right?
prsn has quit [Ping timeout: 250 seconds]
<Drup>
not really
<Drup>
well, actually, it depends what you want to do with the connections when they end
<Drup>
if you don't care, Lwt.async is fine
prsn has joined #ocaml
<Drup>
if you do care, you need to keep the thread around and use something like choose or join.
<dmbaturin>
Where can I see how people are doing it?
<Drup>
hum, not sure I have a nice code example at hand
slash^ has quit [Read error: Connection reset by peer]
_5kg has joined #ocaml
mort___ has quit [Quit: Leaving.]
reem has joined #ocaml
ghostpl_ has joined #ocaml
prsn has quit [Ping timeout: 250 seconds]
prsn has joined #ocaml
ghostpl_ has quit [Ping timeout: 264 seconds]
prsn has quit [Ping timeout: 252 seconds]
prsn has joined #ocaml
kakadu_ has joined #ocaml
kakadu has quit []
The_Mad_Pirate has quit [Ping timeout: 240 seconds]
prsn has quit [Ping timeout: 245 seconds]
The_Mad_Pirate has joined #ocaml
prsn has joined #ocaml
paradoja has quit [Ping timeout: 252 seconds]
govg has joined #ocaml
paradoja has joined #ocaml
prsn has quit [Ping timeout: 252 seconds]
prsn has joined #ocaml
ghostpl_ has joined #ocaml
c355E3B has joined #ocaml
oriba has joined #ocaml
ghostpl_ has quit [Ping timeout: 246 seconds]
shinnya has joined #ocaml
jprakash has quit [Quit: leaving]
thomasga has quit [Quit: Leaving.]
prsn has quit [Ping timeout: 250 seconds]
prsn has joined #ocaml
matason has joined #ocaml
prsn has quit [Ping timeout: 245 seconds]
ggole has quit []
prsn has joined #ocaml
c74d has quit [Read error: Connection reset by peer]
Drup has quit [Quit: Tatayoyo]
reem has quit [Remote host closed the connection]
c74d has joined #ocaml
Nahra has quit [Remote host closed the connection]