monochrom has quit ["Don't talk to those who talk to themselves."]
srv has joined #ocaml
jourdechance has quit ["Leaving"]
Iter has joined #ocaml
CosmicRay has joined #ocaml
zigong_ has quit ["Leaving"]
Iter has left #ocaml []
Iter has joined #ocaml
cjohnson has joined #ocaml
menace has joined #ocaml
Iter has quit [Read error: 110 (Connection timed out)]
cjohnson has quit [Read error: 54 (Connection reset by peer)]
cjohnson has joined #ocaml
arty has joined #ocaml
Xolution has joined #ocaml
ita has quit ["leaving"]
lam has quit ["leaving"]
lam has joined #ocaml
arty has left #ocaml []
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
Xolution has quit [Read error: 110 (Connection timed out)]
menace has quit [Read error: 104 (Connection reset by peer)]
menace has joined #ocaml
menace has left #ocaml []
_fab has joined #ocaml
Lemmih has joined #ocaml
lam has quit ["leaving"]
zigong_ has joined #ocaml
Hadaka has quit [Connection reset by peer]
Naked has joined #ocaml
Naked is now known as Hadaka
gim_ has joined #ocaml
mrsolo has quit [Success]
gim has quit [Read error: 110 (Connection timed out)]
gim_ is now known as gim
<Hadaka>
anyone here familiar with the pagoda core foundation? or alternatively, monads and all in general
zigong_ has quit [Read error: 104 (Connection reset by peer)]
ad\phyz has joined #ocaml
<ad\phyz>
hello
ad\phyz is now known as ad
ad is now known as adai
<adai>
someone knows how to test the existence of a file in caml ?
<mflux>
if it isn't obvious from the Pervasives module documentation, I would say let exists file = try close_in (open_in file); true with someexceptionIcan'trememberbutshouldbeonthepervasivesdocumentation -> false;;
<Smerdyakov>
adai, Sys.file_exists
<mflux>
oh, in Sys then ;)
<adai>
thank's
<adai>
and, what is the variable as argc and **argv ?
<adai>
(in c)
<adai>
isn't is Sys.argc ?
<Smerdyakov>
Keep poking around Sys.
<adai>
isn't it* Sys.argc ?
<Smerdyakov>
Why would you need such a value?
<adai>
so as to test if a command is well used
<Smerdyakov>
Why isn't argv enough?
<adai>
if there are more or less than 2 args, I'll run the usage function
<adai>
argv exists ?
<adai>
ok
<adai>
thank's
<Smerdyakov>
You're gettin' agravating.
<Smerdyakov>
Why can't you read manual pages for yourself?
<adai>
realy, I can't
<adai>
I have to give my exercises in 2 hours
<adai>
I'm sorry :)
<Smerdyakov>
Well, then I guess you deserve trouble for waiting so long!
<adai>
how to test the length of a string array ? ^^
<adai>
I guess you'll say RTFM
<adai>
and you would be true :)
<Smerdyakov>
Now I won't, since you said it for me.
<Smerdyakov>
mflux, which is a pretty nasty way of doing things.
<mflux>
well yes
<adai>
ho, I see
<adai>
than'ks
<mflux>
but that's the way it works
<Smerdyakov>
mflux, OCaml seems almost unique in this bizarre organization.
<mflux>
I wouldn't say unique
<mflux>
python, perl
<Riastradh>
No, there are a lot of other systems that do it this way.
<mflux>
if that's nice company to be with ;)
<Smerdyakov>
mflux, though MLton follows the lead. SMLofNJ's heap export function takes a main function as an argument.
<Riastradh>
Even some Scheme systems do it this way.
<Smerdyakov>
I think it's a ridiculous and overly imperative approach.
<Riastradh>
Sure, it's ridiculous in many circumstances, but it's done.
<ronwalf>
Is there an idiom like python for only calling the main function if the module is the top one?
<ronwalf>
if __name__=='__main__':
<ronwalf>
blah
<ronwalf>
Smerdyakov: It's not so bad for scripting
<Riastradh>
ronwalf, write the executable module separately from the library module.
<ronwalf>
Well durh
<ronwalf>
Ah well, it's not good practice to do simple testing that way, anyways
<adai>
I have a file find.ml, and a file main.ml
<adai>
in find.ml, there is the function "finale"
<ronwalf>
I believe the answer is no, because the modules are executed in the order they are given to the ocaml compiler
<adai>
I compile like that:
<adai>
ocamlc find.ml main.ml -o replace
<adai>
in main.ml I run finale
<adai>
Unbound value finale
<ronwalf>
Find.finale
<adai>
thank's
<ronwalf>
or Use Find;;
<adai>
thank you very much :)
menace has joined #ocaml
<mflux>
let's say I have let f a = ...;;, and I want a return (fun () -> f 42) - is there a way to write this any other (shorter) way?
<mflux>
not like it matters but I wonder if I've missed something of ocaml's syntax ;)
<Smerdyakov>
let f a () = f 42
<mflux>
so in a word no, if I already have f defined
<mflux>
is it considered userful/redundant to always have () as the last argument?
<Smerdyakov>
I don't understand you.
<mflux>
I wan't to return function that does print_string "foo"
<mflux>
is the only way to do it (fun () -> print_string "Foo")
<mflux>
?
<Smerdyakov>
mflux, there is no concept of "return" in OCaml.
<mflux>
well what do you call it?
<Smerdyakov>
mflux, clearly (fun () -> let x = 0 in print_string "Foo") is equivalent.
<Smerdyakov>
mflux, so I really don't understand what you're asking.
<mflux>
yes
<mflux>
let's say I have let foo a b = Printf.printf "%d, %d\n" a b;;
<mflux>
now if I write bar 42 it evaluates to a function
<mflux>
whops, foo 42
<mflux>
but foo 42 42 is evaluated immediately
<Smerdyakov>
Yes, adding an extra () is the canonical way to delay that.
<mflux>
but you can do it only when defining the function?
<mflux>
not when you would like to construct a function without using fun
<ronwalf>
It would be an odd case for a mostly-functional language to consider
<ronwalf>
Do you have to do this often?
<mflux>
well
<mflux>
I'm trying to do something like: let foo () = let rec seq n = (n, (fun () -> seq (n + 1))) in seq 0;;
<mflux>
but it fails to compile ;)
<Smerdyakov>
All recursive types have to go through explicit type definitions in OCaml.
<Smerdyakov>
You're trying to use an anonymous recursive pair type there, which is not allowed.
<mflux>
oh
<mflux>
hmm.. how would the type definition look like?
<mflux>
I get stuck in cyclic type abbreviations ;)
<mflux>
hmm, this works: type foo_func = Foo of (unit -> (int * foo_func));; let foo () = let rec seq n = (n, Foo (fun () -> seq (n + 1))) in seq 0;;
<mflux>
too bad Foo has to be involved - any ideas why this is so? (the same question appeared on the ocaml-beginners list, but no answer)
menace has left #ocaml []
<mattam>
isn't ocaml supposed to work with nptl ?
<Smerdyakov>
mflux, type inference is undecidable without explicit fold and unfold constructs.
dobrek has quit ["ChatZilla 0.9.61 [Mozilla rv:1.7.2/20040820]"]
bk_ has joined #ocaml
zigong_ has joined #ocaml
smimou has quit ["?"]
det_ is now known as det
mwc has joined #ocaml
<mwc>
This is an ocaml newbie question, but what do I do if I need full 32 bit precision from an int? It says that the runtime reserves one bit for itself, so I only have 31 bits of precision on a 32 bit machine
<Riastradh>
I suggest that you read at the manual, in particular regarding the Int32 module.