monochrom has quit ["Don't talk to those who talk to themselves."]
mpc has quit []
<dan2>
whats the best way to daemonize a process in ocaml
slashvar1lri] has joined #ocaml
slashvar[lri] has quit [Read error: 104 (Connection reset by peer)]
mpc has joined #ocaml
mpc has quit [Client Quit]
ne1 has joined #ocaml
ne1 has quit [Client Quit]
ne1 has joined #ocaml
cjohnson has quit ["Leaving"]
vincenz_ has joined #ocaml
vincenz has quit [Read error: 104 (Connection reset by peer)]
ne1 has quit [Read error: 110 (Connection timed out)]
mlh has quit [Client Quit]
mrsolo has joined #ocaml
<mrsolo>
l
mlh has joined #ocaml
mlh has quit [Client Quit]
mlh has joined #ocaml
mlh has quit [Client Quit]
mlh has joined #ocaml
GreyLensman has quit ["Leaving"]
<mflux>
hmh, that pleac-site gives me some server-side message about my firefox 0.8 not being http/1.1-compliant?
<mflux>
once again the site writer has attempted to be smarter than he is :P
<mflux>
or is that the only message the site has to offer
_fab has joined #ocaml
<malte>
dan2, i suppose you could do it as usual: fork, setsid and then dup2
pango has quit ["Client exiting"]
pango has joined #ocaml
buggs has quit [Remote closed the connection]
tea has quit ["using sirc version 2.211+KSIRC/1.3.10"]
shammah has quit ["Leaving"]
mlh has quit [Client Quit]
eugos has joined #ocaml
mrsolo has quit [Read error: 54 (Connection reset by peer)]
mrsolo_ has joined #ocaml
buggs has joined #ocaml
Herrchen has joined #ocaml
bk_ has joined #ocaml
mlh has joined #ocaml
terpstra has joined #ocaml
<terpstra>
err... why is this a problem?:
<terpstra>
This expression has type 'a * Num.num * Num.num * Num.num * int
<terpstra>
but is here used with type Num.num * Num.num * Num.num * int
<terpstra>
shouldn't Num.num match 'a ?
<terpstra>
let rec egcd a b =
<terpstra>
if b =/ (Int 0) then (a, (Int 1), (Int 0), 1) else
<terpstra>
let (q, r) = (quo_num a b, mod_num a b) in
<terpstra>
let (g, i, j, x) = egcd b r in
<terpstra>
(g, j, i, i -/ (q */ j), -x)
<terpstra>
^--- the method causing the error
<terpstra>
(and there's an 'open Num' before the method)
<terpstra>
Similar code worked fine in SML...
<terpstra>
omg - i can't count, forget it
<terpstra>
I can't believe it took me so long to figure out what's wrong, nmind.
<eugos>
terpstra, what is '=/' ? I've never seen it before.
<terpstra>
eugos, compares two Num.num s
<terpstra>
*/ +/ -/ =/ ... all just the Num.num version
<eugos>
terpstra, I see
<mflux>
terpstra, did you actually compile code in between etc?
<mflux>
or just run it in the toplevel..
<mflux>
or maybe perhaps otherwise redefine Num
<mflux>
(without further lookin into the code ;))
<terpstra>
I did find the problem already ... sorry to bother you with it.
<terpstra>
the problem is the last line: (g, j, i, i -/ (q */ j), -x) should be (g, j, i -/ (q */ j), -x)
<terpstra>
it was just rather obscure and since i cut-and-pasted it from a working part of my sml version of this code i thought the expressions at least were ok =)
<eugos>
terpstra, you bother nobody, I'm sure, because the traffic is too low ;-)
<terpstra>
(the error message was obscure I meant)
<mflux>
sometimes the error messages can be somewhat obscure
<terpstra>
fin
daapp has joined #ocaml
daapp has left #ocaml []
daapp has joined #ocaml
buggs has quit [Read error: 238 (Connection timed out)]
<eugos>
I meant, it could be optimized by C compiler
<eugos>
it is not OCaml specific problem, it is the computer restricted world problem
<daapp>
but how to make exact arithmetic with fixed number of digits after point sign?
<daapp>
i have seen something about presition in ocaml 3.08.1 , but no examples
<daapp>
i mean precision
daapp has left #ocaml []
daapp has joined #ocaml
<det>
daapp: you do understand that floats are approximizations?
<det>
Oh, I see, you do
<daapp>
i understand this , :) but i need to calculate numbers with 2 digit after point using + - and *, what is the simple way for this
<det>
I tried a few other languages, they all agree with ocaml, looking at the assembly, I see GCC optimizes it at runtime and the program never actuallys adds them, it just printfs 0
<det>
s/runtime/compile time/
cjohnson has joined #ocaml
<det>
"2 digit after point" ?
<daapp>
i understand that gcc sometimes lie, i have try many other languages with the same success, but i can't find the answer: how to make exact arithmetic calculations with restricted precision?
daapp has left #ocaml []
daapp has joined #ocaml
<eugos>
daapp, what do you need it for?
<eugos>
daapp, what task?
<daapp>
a lot of target, count money, draw simple graphics of functions and many more, i understand that i can create new type like ExactFloat and so on, but i hope somebody make it and don't wan't to make yet another implementation
<malte>
hm. i have serious trouble getting mod_ocaml working properly :(
<malte>
it totally bails out if my source code starts with #load "file.ml";;
<malte>
i mean #use "file.ml";; but i doubt it matters
daapp has left #ocaml []
<eugos>
daapp, sometimes one can formulate a task another way, say, to use int instead of float
<malte>
the thing is it seems to parse the ocaml source differently everytime i reload the page :) very mysteriously
<malte>
anyone else having this problem?
<det>
the C GNU MP library has arbitrary presition floats
<det>
maybe there is an ocaml binding?
<det>
eugos: maybe you want to use rationals and then truncate when you need a deciaml?
<terpstra>
det, Sure, it's called 'Num' :-)
<terpstra>
(although not with GMP i think - use mlton for that)
<eugos>
just wanted to say, terpstra knows :)
<terpstra>
he left already though, and I was gone while he asked =)
<eugos>
det, it's not to me, to daapp ;)
<det>
oh, right :)
<terpstra>
Why didn't anyone suggest he just use an int?
<eugos>
I suggested
<det>
terpstra: MLton only uses gmp for arbitrary length integers, I thought
<terpstra>
det, possibly; to be honest, that's the only part I care about, so I'm not sure about floats.
<terpstra>
ocaml Num has arbitrary float precision for sure though
<terpstra>
well, rational really
* terpstra
is so happy happy happy. =)
<terpstra>
SML proved correct his algorithm, and fftw3 (the ocaml part) was so easy to modify.
karryall has joined #ocaml
eugos has quit ["Leaving"]
eugos has joined #ocaml
vincenz_ is now known as vincenz
monochrom has joined #ocaml
mlh has quit [Client Quit]
buggs|afk has joined #ocaml
buggs|afk is now known as buggs
terpstra has quit [Read error: 110 (Connection timed out)]
<eugos>
I don't understand what I'm doing wrong. I' trying to set a breakpoint in a module called Fetch and receive a syntax error from ocamldebug
<eugos>
(ocd) b @ Fetch 232
<eugos>
232 is a line number
terpstra has joined #ocaml
<eugos>
according to the documentation it looks like: break @ [module] line
<eugos>
so, what's wrong? :/
<eugos>
terpstra, hi, again for you:
<eugos>
I don't understand what I'm doing wrong. I' trying to set a breakpoint in a module called Fetch and receive a syntax error from ocamldebug
<eugos>
(ocd) b @ Fetch 232
<eugos>
;)
<eugos>
maybe I give the module name in a wrong form?
beschmi has joined #ocaml
<karryall>
eugos: try break @Fetch 232
<eugos>
karryall, thanks, it helped
<eugos>
karryall, so it was wrong to use 'b' insteas of 'break'
eugos has left #ocaml []
<karryall>
it was wrong to put a space after the @
<Smerdyakov>
Tell God you're sorry.
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
monochrom has quit ["Don't talk to those who talk to themselves."]
_fab has quit []
<terpstra>
anyone know how to get a stack trace along with an exception?
<mellum>
terpstra: compile with the bytecode compiler and -g
<terpstra>
thanks
<terpstra>
still doesn't do it. hrm.
<mellum>
works for me[tm]
<karryall>
you have to set an env. variable: OCAMLRUNPARAM=b
<mellum>
Oh, right. I probably hardcoded that somewhere...
<terpstra>
ahh, thanks
<terpstra>
woah!
<terpstra>
that's a stack trace
<terpstra>
it would seem that lazy evaluation is hard to debug =D
bk_ has joined #ocaml
bbls has joined #ocaml
<bbls>
hello
<bbls>
anyone here who can help me a bit?
<bbls>
i have a question regarding MetaML (or meta languages in general)
<terpstra>
if i can...
<bbls>
do you know eval function in lisp?
<terpstra>
takes a string and runs it?
<bbls>
i mean in general a function that takes a string and returns code (like curried functions)
<bbls>
(not just eval the string)
<bbls>
but return code
<bbls>
for a function equivalent
<bbls>
with the one defined by the string
<bbls>
my question is if there is a language where a such eval function
<bbls>
could be implemented inside a library
<bbls>
and not in core language
<terpstra>
hmmm, i've only used mlton and ocamlopt, and i would be surprised if it was possible there.
<terpstra>
... but i wouldn't rule it out for interpretted versions of sml.
<terpstra>
sorry not to be very helpful on that one =)
<bbls>
np :)
<bbls>
it's a difficult question anyway :)
<terpstra>
err wait.
<terpstra>
I take it back, you could definitely hack it in mlton =)
<terpstra>
as long as you had the compiler handy, and dl support...
<bbls>
what do you mean by "hack"?
<bbls>
no
<bbls>
no compiler addon
<bbls>
just a basic library
<terpstra>
you could do system("mlton tmp.sml")
<bbls>
no
<bbls>
not like this
<bbls>
this is cheating :)
<terpstra>
how so? it would even be reasonably performant.
<bbls>
i'm interested in the functionality itself
<bbls>
not coding a real world program
<karryall>
bbls: see the ocaml toplevel
<terpstra>
karryall, good point!
<bbls>
what do you mean?
<terpstra>
heh, here's a choice bit of sml:
<terpstra>
fun p nil x = 0 | p (a :: l) x = a + x * p l x
<terpstra>
bbls, he means the ocaml top-level does it
<terpstra>
so, look at how it works
<terpstra>
in the top-level you type in ocaml interactively, and it evaluates it, so it must do what you need
<bbls>
haha
<bbls>
but this is ridiculous
<bbls>
i mean within the language
<terpstra>
of course, look at how they do it
<terpstra>
maybe there's a hook we don't know
<terpstra>
but whatever the best way to do it is, it will be in that code
<bbls>
is ocaml top level written in ocaml?
<terpstra>
of course
<bbls>
including the compilation of other ocaml code
<bbls>
without the use of external (native) eval(string) function?
<terpstra>
i don't know how it works, but it does what you describe.
<terpstra>
since the authors of ocaml wrote it, you can bet it uses the best possible mechanism
<bbls>
it is no use if it just do system("mlton tmp.sml")
<terpstra>
i doubt it does that
<bbls>
or uses some other hidden hook
<bbls>
or function
<bbls>
like do_sml("tmp.sml")
<bbls>
that calls some internal compiler
<terpstra>
if you care about this, then why not find out what it does?
<bbls>
because it's language question
<bbls>
not an implementation question
<bbls>
is related to the posibility of the language
<bbls>
to act as meta language
<pango>
bbls: check caml weekly news, I think they talked about this
<pango>
bbls: I think they mentionned glsurf, among things
Herrchen has quit [Read error: 104 (Connection reset by peer)]
monochrom has joined #ocaml
jason_ has joined #ocaml
<jason_>
I'm defining a library of expressions that I link with different pieces of code. When I don't use one of these expressions, the compiler can't determine a type for it.
<jason_>
How do I avoid having to tell it what the type of that routine is?
<jason_>
I mean, I could remove all of the routines that I'm not using from the .ml file.
<jason_>
Anybody? :P
<terpstra>
i'm not sure what you mean =)
<terpstra>
erp - and i have to go
terpstra has quit ["Leaving"]
bbls has left #ocaml []
<Smerdyakov>
jason_, it is good practice to provide a signature for every module in a library, anyway.
<Smerdyakov>
It's good documentation for users.
<jason_>
Alright.
<jason_>
I just made a wrapper around Str.regexp that uses the overloaded operator "=~" like perl.
<jason_>
Except the language is actually expressive enough to do it without having it built directly into the syntax.
eugos has joined #ocaml
cjohnson has quit [Read error: 104 (Connection reset by peer)]
cjohnson has joined #ocaml
eugos has quit ["Leaving"]
mpc has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
mpc has quit []
mpc has joined #ocaml
maihem has joined #ocaml
mpc has quit []
mpc has joined #ocaml
GreyLensman has joined #ocaml
monochrom has quit ["Don't talk to those who talk to themselves."]