vect changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn, ICFP'03 http://www.icfpcontest.org/, A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/, A free book: http://cristal.inria.fr/~remy/cours/appsem, Mailing List (best ml ever for any computer language): http://caml.inria.fr/bin/wilma/caml-list
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
Kinners has joined #ocaml
voltron has quit [Remote closed the connection]
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
Tabu-la-Rasa has joined #ocaml
clam has quit ["no reason"]
Kinners has left #ocaml []
Riastrad1 has joined #ocaml
Riastradh has quit [Read error: 110 (Connection timed out)]
mattam_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
brwill is now known as brwill_zzz
__DL__ has joined #ocaml
systems has joined #ocaml
buggs|afk is now known as buggs
<Maddas> hm, having closures is good.
Vincenz has joined #ocaml
Rhamphoryncus has joined #ocaml
* Rhamphoryncus pokes his head in
systems has quit [Nick collision from services.]
* Demitar looks at Rhamphoryncus.
systems has joined #ocaml
<Rhamphoryncus> ahh life ;)
mattam_ is now known as mattam
Fleur has joined #ocaml
Fleur has left #ocaml []
mattam is now known as mattam_
mattam_ is now known as mattam
systems has quit [Read error: 60 (Operation timed out)]
systems has joined #ocaml
mattam has quit ["irssi update"]
mattam has joined #ocaml
mattam has quit [Client Quit]
mattam has joined #ocaml
mattam has quit [Client Quit]
bk__ has joined #ocaml
clam has joined #ocaml
systems has quit ["Client Exiting"]
systems has joined #ocaml
mattam has joined #ocaml
clam has quit ["no reason"]
systems has quit [Connection timed out]
Riastrad1 is now known as Riastradh
Riastradh has quit [Nick collision from services.]
Riastradh has joined #ocaml
bk__ has quit ["I'll be back"]
atom-z has joined #ocaml
<atom-z> does ocaml have the equiv. of python's filter()?
<Riastradh> Yes, cf. the List module.
<atom-z> wheres the language reference?
<Demitar> You'll find it at caml.inria.fr
<Riastradh> It's not part of the _language_; it's part of the _library_.
<atom-z> ok, library reference then
<atom-z> thanks
<Riastradh> http://www.ocaml.org/ -> OCaml Manual -> scroll down
systems has joined #ocaml
<atom-z> how do i include module list?
<Demitar> atom-z, what is it that you want to do?
<phubuh> atom-z, just refer to its members like, say, List.filter
<atom-z> have a function that returns all the positive integers in a list of integers
* Demitar finally figured what atom-z asked. ;-)
<phubuh> you can do "open List" if you really don't want to prefix the identifiers with "List.", but open directive are normally avoided
<atom-z> ok
<Maddas> atom-z: just use List.length, etc., you don't need any special statement to include it
<atom-z> Maddas: yeah, but i was wondering if i could "use namespace List; "(C++), phubuh answered my question though
<Maddas> ok :)
* Demitar would have liked scoped open statements.
<phubuh> Demitar, there is a camlp4 hack to do that
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
<Demitar> phubuh, neat, although a module L = ... statement can get almost the same effect I guess.
<atom-z> is it possible to access List.filter in an object oritented way i.e. listObj.filter(function)?
* Demitar shudders as the box starts swapping (24M ram simply isn't enough).
<Riastradh> atom-z, no, unless you write a list class that supports a filter method, but that would be kind of silly.
<mattam> aren't statements like 'let _ = dosmthg' always evaluated at program startup (before statements in modules which are next on the command line) ?
<mattam> i have a case where it doesn't work
<atom-z> ok
<atom-z> thanks for the help
<mattam> this is really anoying :(
<Demitar> mattam, afaik any toplevel commands should be run in the module linking order. (That is: yes.)
<mellum> mattam: maybe you have a typo? try let () = ... to see whether you didn't accidentally define a function
<mattam> mellum: ?
<mellum> mattam: !
<Demitar> mellum: "All hail ignore"? ;-)
<mattam> i don't understand what you mean mellum
<Riastradh> mattam, if the RHS is a function, then it won't get evaluated.
<Demitar> mattam: "let _ = List.map (fun x -> x ^ x)" is valid but doesn't do anything.
<Riastradh> let () = ... won't work for that case, anyways, because List.map returns a list, not unit.
<mattam> :) no, it is not that sort of errors
<atom-z> hmm
<atom-z> how do i write a function that takes a' and returns a bool (for filter)?
<mattam> i have an x = ref [] in one module and i do 'let _ = Mod.x := [foo; bar]' in the other one
<atom-z> i want it to see if the element is positive, or now
<atom-z> err
<atom-z> *not
<Smerdyakov> mattam, have you specified the type of x somewhere for the first module?
<mattam> Smerdyakov: yep, in the mli and the ml
<mattam> i tried doing the same with three files and it works (let x = ref [] in init.ml let _ = x := [1; 2] in snd.ml and let _ = {print x list} in main.ml. Compiled with ocamlc init.ml snd.ml main.ml)
<mattam> i'm absolutely clueless
<atom-z> i cant seem to find an example of how to use filter
<atom-z> iirc 'a means anything
<Riastradh> atom-z, write something in Python that would filter out all the element of 'list' that are greater than 5.
<Maddas> atom-z: which part don't you understand?
<mellum> atom-z: List.filter (fun x -> x > 17) [6; 23; 666; 0]
<atom-z> def positive(n):
<Maddas> your function doesn't *need* to take 'a
<atom-z> return n > 5
<atom-z> filter(n,list)
<Riastradh> Does that actually _work_, now?
<atom-z> Riastradh: the python code?
<Riastradh> Yes.
<Riastradh> It doesn't look to me as though it will.
systems has quit [Read error: 60 (Operation timed out)]
<Riastradh> I think you probably meant 'filter(positive, list)'.
<atom-z> yes it does
<Riastradh> Even then, it's rather silly to define positive. Are you not aware of lambda?
<atom-z> oh yeah
<atom-z> that is a small typo
<atom-z> yeah i know about lambda
<Riastradh> OCaml's lambda is 'fun' or 'function.'
<atom-z> ok
<atom-z> mellum: that works, i was calling filter like List.filter(f,l)
<Maddas> List.filter doesn't take a tuple :)
brwill_zzz is now known as brwill
<atom-z> so that doesnt call it with the parameters f,l it calls it with one parameter, a tuple (f,l)?
<mellum> Yes. You cannot call a function with two parameters, all functions have only one.
<atom-z> ah i see
<atom-z> thanks
<Maddas> atom-z: your call would have called it with a tuple, yes
<mattam> apparently the module that redefines the variable isn't initialized. A print_endline "initializing";; doesn't work either
<mattam> duh, it's in my.cma, but if i add it like this: ocamlc my.cma redefiner.cmo main.ml it works ??? It should work without that and there should be errors for redefinitions also. Did i overlooked something ?
<mattam> -linkall !
<Demitar> mattam, three minor suggestions, 1. try without let _ = 2. try without .mli 3. try without using a lib (compile all the .ml files and link in one run). This is mostly shotgun debugging of course.
<mattam> i works now Demitar, -linkall was missing
<mattam> i can't think of why the default is not to link all object files
* Demitar read the manual and coincides that it makes sense.
<mattam> lost 45 minutes on that
<Demitar> mattam, efficiency?
<mattam> you mean space efficiency ?
* Demitar notes that he should get back to his programming.
<Demitar> mattam, something like that.
<mattam> well, i do not find it sensible to have an optimization that changes the semantics of linking like that as a default. Maybe i'm getting a bit subjective on the issue though :p
* mattam back to code
<Demitar> Well, C/C++ does the same thing.
<Demitar> (That is many *compilers* naturally.)
__DL__ has quit [leguin.freenode.net irc.freenode.net]
Smerdyakov has quit [leguin.freenode.net irc.freenode.net]
brwill has quit [leguin.freenode.net irc.freenode.net]
det has quit [leguin.freenode.net irc.freenode.net]
__DL__ has joined #ocaml
brwill has joined #ocaml
Smerdyakov has joined #ocaml
det has joined #ocaml
Riastradh has quit [Read error: 54 (Connection reset by peer)]
Riastradh has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastradh has joined #ocaml
polin8 has quit [Read error: 104 (Connection reset by peer)]
polin8 has joined #ocaml
systems has joined #ocaml
Rhamphoryncus has left #ocaml []
clog has joined #ocaml
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
__DL__ has quit [Remote closed the connection]
Riastrad1 has joined #ocaml
Riastradh has quit [Nick collision from services.]
Riastrad1 is now known as Riastradh
clam has joined #ocaml
<mattam> Demitar: is it ? :)
polin8 has quit ["Now _that's_ a good cup of coffee."]
<Demitar> mattam: Eh? (Was that perhaps a pun on my misspeling I didn't get? ;-)
lus|wazze has joined #ocaml
lus|wazze has quit [Read error: 104 (Connection reset by peer)]
Vincenz has quit []
lus|wazze has joined #ocaml
atom-z has quit ["Client Exiting"]