ulfdoz has quit [Read error: 145 (Connection timed out)]
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
cjohnson has quit [Read error: 145 (Connection timed out)]
Smerdyakov has joined #ocaml
Smerdyakov has quit [Client Quit]
Sonarman has quit [Read error: 110 (Connection timed out)]
<ulfdoz_>
re
Submarine has joined #ocaml
noj has quit [niven.freenode.net irc.freenode.net]
noj has joined #ocaml
vodka-goo has joined #ocaml
Submarine has quit ["Leaving"]
mattam has quit [Read error: 110 (Connection timed out)]
Herrchen has joined #ocaml
pango has quit [Remote closed the connection]
Submarine has joined #ocaml
pango has joined #ocaml
mlh has quit [Client Quit]
smimou has joined #ocaml
mrvn has joined #ocaml
mrvn_ has quit [Read error: 110 (Connection timed out)]
Submarine has quit ["Leaving"]
<araujo>
do i always need to declare main in a program?
<det>
no
<det>
It is a common convention to do "let main () = ..." "val _ = main ()"
<det>
err s/val/let/
<araujo>
mm.. what is the 'val' for?
<araujo>
ah ok
<det>
SMLism
<mellum>
or better, let () = main ()
<araujo>
But i don't get it.. so i always end up declaring main
<det>
mellum, I couldn't remember if you could do that in O'Caml
<smimou>
yes you can and it's better since it typchecks that the result is actually of type unit
<det>
araujo, You could put the body of main at the top level if you wanted
<det>
araujo, making it a function is nicer
<slashvar[lri]>
det: put it at the toplevel is not a good idea, and may be source of irrating and hidden errors (there's some ambiguity with phrase not begining with let ...)
<det>
slashvar[lri], I dont understand your explanation of why it is a bad idea
<slashvar[lri]>
but, you dont realy need a function called main, you may just write let _ = (* put something here ... *)
<araujo>
det: mm,
<det>
slashvar[lri], I agree it is a bad idea, however
<araujo>
I was doing something like this in my code: "let main = ....."
<det>
araujo, not "let main () =" ?
<araujo>
But i didn't do, let () = main () ; nevertheless, it seems to work
<araujo>
det: correct
<araujo>
without ()
<det>
araujo, You are declaring main to have a value of the following expression
<araujo>
yes, that0s the way to go right?
<slashvar[lri]>
det: in an ocaml source, everything is divide in phrase, but the begining/ending of phrase is not very clear, unless you use let (to begin) or ;; (to end)
<det>
araujo, do you understand the difference between "let main = ..." and "let main () = ..."?
<slashvar[lri]>
araujo: in that case, just do let _ = ... or let () = ..., you don't have to put the result of the principal action in a variable (especialy if it's unit ... )
<det>
slashvar[lri], What do you mean by "phrase"
<slashvar[lri]>
det: just an example : let f x = x
<slashvar[lri]>
is a phrase
<slashvar[lri]>
(a toplevel expression)
<det>
Oh, I see what you are saying
<det>
slashvar[lri], SML has a more obvious syntactic distinction between declaring a value and a function, such as "val foo = 1" and "val increment x = x + 1"
<det>
slashvar[lri], O'Caml's default syntax blurs the line
<araujo>
det: the first one doesn't specify any parameter?
<slashvar[lri]>
det: there's historical reasons (things from camllight)
<araujo>
slashvar[lri]: ooh i see, nice
Submarine has joined #ocaml
<det>
slashvar[lri], "let foo () = ..." is like "let foo = fun () -> ..."
<det>
slashvar[lri], the first one doesnt define a function
<det>
slashvar[lri], it defines a value
<det>
err
<slashvar[lri]>
araujo: no, the first one is evaluated directely, the second only when called
<det>
"val foo = 1" and "fun increment x = x + 1"
<slashvar[lri]>
(so in let main = ... ;; let _ = exit 0 ;; main is evaluated, in let main () = ... ;; let _ = exit 0 ;; main is not evaluated ...)
<araujo>
slashvar[lri]: oooh, yeah, a lot of sense, thanks
<slashvar[lri]>
det: beware, a function is a value, it's that it can be applied, but there's no distinction between functions and values.
<slashvar[lri]>
(it's just that it ... )
<det>
slashvar[lri], value restriction :-)
<slashvar[lri]>
so, sorry, but I got to go to eat something now, befor there's nothing less ...
<slashvar[lri]>
see you later ...
<det>
# let x = List.map (fun x -> x);;
<det>
val x : '_a list -> '_a list = <fun>
<det>
# let x list = List.map (fun x -> x) list;;
<det>
val x : 'a list -> 'a list = <fun>
<det>
Difference there
* araujo
thinks he found a slight typo in the standard library
<araujo>
Shouldn't the execvep function description something like: Same as Unix.execvep respectively, except that the program is searched in the path
<araujo>
Unix.execve*
_JusSx_ has joined #ocaml
<mflux>
yeah, I think that's a documentation bug
<mflux>
such things are easy to miss
<mflux>
I wonder if a static type system or theorem prover for documentation would help :-o
<mflux>
;)
<xcar>
hi, how can i remove an element from arrays?
<mellum>
xcar: you can't
<araujo>
mflux: ah ok, just wanted to know i wasn't misunderstanding it
<xcar>
thanks mellum. I can create a new copy instead remove a member on arrays. are there any performance issues I need care in this way?
<mellum>
xcar: if you need to remove an element, you're probably using the wrong data structure in the first place
<xcar>
thanks mellum. I will recheck it.
xcar has quit [Remote closed the connection]
* slashvar[lri]
is back
<slashvar[lri]>
det: in let x = List.map (fun x -> x), the difference in the type comme from some restriction in the type inference algorithm
<slashvar[lri]>
('_a is a type variable without quantification ... )
<slashvar[lri]>
(i.e that is not generalized ... )
<det>
slashvar[lri], That is why I said values and functions are different
<det>
slashvar[lri], values cannot be polymorphic
<slashvar[lri]>
this not realy the point, the '_a come from the application outside of the generalization done by the let
<slashvar[lri]>
in the second form you reintroduce the \lambda abstraction and its parameter is generalize, in the first, you do not, but both are functions
<slashvar[lri]>
if you don't apply the function, you will keep the universal quantification
<mflux>
I wonder, the limitation could be easily overcome by rewriting such cases with let x y = ... y, why is it not done?
<slashvar[lri]>
mflux: this is simple here, but in main case you have to infer what the programmer wants
Gueben has joined #ocaml
Gueben has quit [Client Quit]
er has joined #ocaml
er has quit [Client Quit]
Bonedigger has joined #ocaml
Submarine has quit [Remote closed the connection]
__DL__ has joined #ocaml
Bonedigger has quit ["Leaving"]
Submarine has joined #ocaml
cjohnson has joined #ocaml
bk_ has joined #ocaml
joeytwiddle has quit ["Leaving"]
Gueben has joined #ocaml
Gueben has quit [Client Quit]
Gueben has joined #ocaml
Gueben has quit [Client Quit]
fam has joined #ocaml
Purice has joined #ocaml
fam is now known as wam
wam is now known as xchat-es-mierda
madroach has joined #ocaml
<madroach>
Hi, I want to register a dynamically allocated c variable containing a value to the ocaml gc. May I use caml_register_global_root for this purpose?
<Submarine>
yes
<madroach>
That's a really short and precise answer. Thanks!
mush_ has joined #ocaml
<mush_>
hi all :p
madroach has quit ["leaving"]
Hadaka has quit [Read error: 145 (Connection timed out)]
Snark has joined #ocaml
<Snark>
slt
<Snark>
I would like to set some compile-time options in an ocaml program
<Snark>
shall I create a common.ml that will set them?
mush_ has quit [Remote closed the connection]
vezenchio has joined #ocaml
Naked has joined #ocaml
Naked is now known as Hadaka
pango has quit ["Leaving"]
xchat-es-mierda has quit [Read error: 104 (Connection reset by peer)]
xchat-es-mierda has joined #ocaml
cjohnson has quit [Success]
cjohnson has joined #ocaml
xchat-es-mierda has quit [Read error: 104 (Connection reset by peer)]
Aradorn has joined #ocaml
pango has joined #ocaml
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
Aradorn has quit [Read error: 104 (Connection reset by peer)]
Submarine has quit ["Leaving"]
Herrchen has quit ["good night"]
Purice has quit ["Leaving"]
Submarine has joined #ocaml
<Snark>
good night
Snark has left #ocaml []
smimou has quit ["?"]
jesuismoi has joined #ocaml
christos_13 has joined #ocaml
Gueben has joined #ocaml
CosmicRay has joined #ocaml
Submarine has quit ["Leaving"]
cp has joined #ocaml
CosmicRay has quit [Read error: 145 (Connection timed out)]
<cp>
hi, i am using ocaml 3.08.3.. when trying to execute a file by typnig ' use "foobar.ml" ' ocaml says "unbound value use"
<jesuismoi>
hi cp
<cp>
hi
<cp>
ok, it's #use
<cp>
just found it.. then my tutorial was wrong again..
cjohnson has quit [""We live like penguins in the desert...""]
monochrom has joined #ocaml
Gueben has quit ["plouf"]
__DL__ has quit [Remote closed the connection]
vodka-goo has quit []
hangman4 has joined #ocaml
jesuismoi has quit ["Chatzilla 0.9.68a [Firefox 1.0/20041107]"]
_JusSx_ has quit ["leaving"]
cjohnson has joined #ocaml
Zaius has joined #ocaml
<Zaius>
greetings
<Zaius>
how do i inherit from a parameterized class?
<monochrom>
I can't remember. I recall doing it. I think the doc's chapter on OOP has it.
monochrom has quit ["me!"]
Zaius has quit []
christos_13 has quit [Read error: 104 (Connection reset by peer)]