love-pingoo has quit [Read error: 110 (Connection timed out)]
Morphous_ has quit [Read error: 104 (Connection reset by peer)]
Ched- has joined #ocaml
<fbvortex>
I'm doing some file I/O by calling I/O functions within a begin...end block. At some point within the begin...end block, I need to conditionally call either 1 or 2 I/O functions, both of which return Unit. An example of the conditional part: if (cond) then iofunc1 arg1 else begin iofunc2 arg2; iofunc3 arg3 end . However, the compiler complains that the else clause that starts with "begin" is not a function and cannot be applied. What is the co
<fbvortex>
If I make the else clause just call a single I/O function without a begin...end, then the compiler doesn't complain. However, I need to make two different calls. I don't care about the return value of any of them...
<pango>
you must have an error somewhere, there's no fundamental reason for this to fail, I/O functions or else
jlouis has quit [Remote closed the connection]
<pango>
double check what part of your code is underlined when the error is displayed
<fbvortex>
weird, I needed a semicolon after the end on the else clause
Ched has quit [Read error: 110 (Connection timed out)]
<pango>
that seem consistent with the error message
<rwmjones_>
ah right, it was for ocaml-libvirt, found it
<jynxzero>
(Oops, accidental paste, sorry!!)
asmanur` has joined #ocaml
asmanur has quit [Read error: 110 (Connection timed out)]
<letrec>
flux: Yoric[DT], regarding the map<> stuff, the Map.iter will depend on the way compare works for turple. So iter itself is undefined when using turple, right?
<flux>
letrec, you can define a comparison function yourself
<flux>
letrec, the let compare = compare was a lazy way to do that
<bluestorm>
btw letrec you probably should not rely on the iteration order, as it is more or less implementation-dependent
<bluestorm>
(it's specified in the documentation so is not meant to change, but having an unspecified evaluation order would not make Map.iter "undefined")
<jynxzero>
Sorry to butt in, that seems a bit odd, if we can't rely on things specified in the documentation, how do we know what we can rely on??
<jynxzero>
It seems that that is going to result in a lot of re-implementation of things like iter just so we can rely on the ordering, that is already specified in the documentation.
<letrec>
flux: ok, makes sense, I can define my own compare indeed. But the iteration order should be defined, surely?? It does matter when writing algorithms.
seafood has joined #ocaml
pango has quit [Remote closed the connection]
<flux>
letrec, it is my understanding iter will walk the tree from min to max elt, I don't remeber what the docs say
Linktim has joined #ocaml
pango has joined #ocaml
bzzbzz has joined #ocaml
Axioplase_ is now known as Axioplase
<mfp>
the iteration order _is_ specified "The bindings are passed to f in increasing order with respect to the ordering over the type of the keys."; the precise semantics of compare relative to tuples and others isn't
<letrec>
Also, I'm writing stuff like let (a,b) = Scanf.scanf "%s %s\n" (fun x y -> (x,y)) in... Is there a better way of doing that?
<letrec>
I've got module M = Map.Make (...) I need to define a reference to it... let m = ref M.empty doesn't work. How can I do? Thanks
Linktim has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
<Smerdyakov>
letrec, your questions tend to be too vague.
<Smerdyakov>
letrec, please link to an example program and the error message you get or other reason that you think it "doesn't work."
<letrec>
Please don't be offensive. If you don't understand my questions, just don't answer. Usually, I'm being understood by ocaml guys on this list.
<Smerdyakov>
I'm not being offensive. I'm trying to help you.
asmanur` has quit [Read error: 110 (Connection timed out)]
coucou747 has joined #ocaml
<Smerdyakov>
...and you might want to consider that, even if people here manage to figure out what your questions mean, you are being rude to them by being unclear and forcing them to analyze your question.
<Smerdyakov>
"Doesn't work" is a phrase that should never appear in questions about programming.
<Smerdyakov>
You should state your expectation and explain what happens instead.
<bluestorm>
letrec: in a nutshell, he's asking for your code
<Smerdyakov>
Every line I've written is conveying new information. The message can't be condensed into "asking for his code."
<Smerdyakov>
Concrete code examples are a useful part of the right way to ask programming questions, but stating expectations explicitly is another key part.
<flux>
letrec, you can just use cps: don't construct the tuple, but put the code right in the function part of scanf
<bluestorm>
heh, i had never thought of Scanf as a continuation passing function
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
pattern has quit [Remote closed the connection]
asmanur has joined #ocaml
love-pingoo has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
Maslowski has left #ocaml []
palomer has joined #ocaml
gaja has quit [Read error: 110 (Connection timed out)]
l_a_m has quit [Remote closed the connection]
<flux>
I took the perspective after writing a similar function :)
<bluestorm>
maybe there should be a [> or [< somewhere ?
<palomer>
I'm doing an explicit coercion
olegfink has left #ocaml []
<fbvortex>
is it possible to compile two modules which depend on each other?
<pango>
no
<flux>
if they are in different files, then no
<palomer>
fbvortex, not if they're in two different files
<palomer>
it's a huge bummer
<palomer>
(I spend hours finding ways to get around this)
<flux>
however, there are ways around this. you can have a module type signature and make the other module take it as a parmaeter
<palomer>
but then the type signatures can't be mutually recursive, right?
<palomer>
and the modules can't be toplevel
<fbvortex>
yes, the way it's arranged now, each module is in one file. I can probably re-arrange the code though. thanks guys.
<flux>
I personally haven't found that to be a too big of an issue. I've used classes for things that could be modules, though, and recursive class types are simple
<palomer>
flux, they still need to be in 1 file
<palomer>
I don't like having 1000 line files
<bluestorm>
use camlp4 and #INCLUDE
<palomer>
won't that screw up my error messages?
<bluestorm>
i actually haven't tried, but there is quite a possibility it doesn't
mtrimpe has joined #ocaml
Deffie_ has quit []
love-pingoo has quit [Read error: 145 (Connection timed out)]
love-pingoo has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
asmanur` has joined #ocaml
mtrimpe has quit [Read error: 104 (Connection reset by peer)]
mtrimpe has joined #ocaml
mtrimpe has quit [Connection reset by peer]
mtrimpe has joined #ocaml
Axioplase is now known as Axioplase_
asmanur has quit [Read error: 110 (Connection timed out)]
Tetsuo has quit [Read error: 54 (Connection reset by peer)]
Tetsuo has joined #ocaml
Tetsuo has quit [Read error: 104 (Connection reset by peer)]
asmanur` has quit [Read error: 110 (Connection timed out)]