Banana changed the topic of #ocaml to: OCaml 3.08.1 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
srv has quit [Remote closed the connection]
srv has joined #ocaml
malc_ has quit ["leaving"]
bacam has quit [zelazny.freenode.net irc.freenode.net]
bacam has joined #ocaml
bacam has quit [zelazny.freenode.net irc.freenode.net]
cjohnson has quit [zelazny.freenode.net irc.freenode.net]
fooli has quit [zelazny.freenode.net irc.freenode.net]
pflanze has quit [zelazny.freenode.net irc.freenode.net]
_shawn has quit [zelazny.freenode.net irc.freenode.net]
shammah has quit [zelazny.freenode.net irc.freenode.net]
zigong has quit [zelazny.freenode.net irc.freenode.net]
oracle1_ has quit [zelazny.freenode.net irc.freenode.net]
mellum has quit [zelazny.freenode.net irc.freenode.net]
slashvar[lri] has quit [zelazny.freenode.net irc.freenode.net]
det has quit [zelazny.freenode.net irc.freenode.net]
pawelb has quit [zelazny.freenode.net irc.freenode.net]
mattam has quit [zelazny.freenode.net irc.freenode.net]
_fab has quit [zelazny.freenode.net irc.freenode.net]
haakonn has quit [zelazny.freenode.net irc.freenode.net]
tnks has quit [zelazny.freenode.net irc.freenode.net]
creichen has quit [zelazny.freenode.net irc.freenode.net]
buggs has quit [zelazny.freenode.net irc.freenode.net]
srv has quit [zelazny.freenode.net irc.freenode.net]
GreyLensman has quit [zelazny.freenode.net irc.freenode.net]
Hadaka has quit [zelazny.freenode.net irc.freenode.net]
lmbdwr has quit [zelazny.freenode.net irc.freenode.net]
Smerdyakov has quit [zelazny.freenode.net irc.freenode.net]
vincenz has quit [zelazny.freenode.net irc.freenode.net]
Tristram has quit [zelazny.freenode.net irc.freenode.net]
simon has quit [zelazny.freenode.net irc.freenode.net]
TheDracle has quit [zelazny.freenode.net irc.freenode.net]
mflux has quit [zelazny.freenode.net irc.freenode.net]
Excedrin has quit [zelazny.freenode.net irc.freenode.net]
clog has joined #ocaml
mflux has joined #ocaml
Excedrin has joined #ocaml
TheDracle has joined #ocaml
simon has joined #ocaml
Tristram has joined #ocaml
vincenz has joined #ocaml
Smerdyakov has joined #ocaml
lmbdwr has joined #ocaml
Hadaka has joined #ocaml
GreyLensman has joined #ocaml
srv has joined #ocaml
avn has joined #ocaml
Niccolo has joined #ocaml
avlondono has joined #ocaml
gl has joined #ocaml
slashvar[lri] has joined #ocaml
cjohnson has joined #ocaml
bacam has joined #ocaml
mellum has joined #ocaml
oracle1_ has joined #ocaml
zigong has joined #ocaml
shammah has joined #ocaml
_shawn has joined #ocaml
pflanze has joined #ocaml
skylan has joined #ocaml
det has joined #ocaml
melchus has joined #ocaml
Demitar has joined #ocaml
pango has joined #ocaml
Godeke has joined #ocaml
dan2 has joined #ocaml
Nutssh has joined #ocaml
cmeme has joined #ocaml
judge has joined #ocaml
CosmicRay has joined #ocaml
cjohnson has quit ["The main attraction: distraction"]
fooli has joined #ocaml
mrsolo has joined #ocaml
kinners has joined #ocaml
dan2 is now known as dan
CosmicRay has quit ["Leaving"]
dan is now known as dan2
mrsolo has quit ["Leaving"]
kinners has quit [Read error: 110 (Connection timed out)]
mrsolo has joined #ocaml
CosmicRay has joined #ocaml
ionOS has joined #ocaml
mrsolo_ has joined #ocaml
mrsolo has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
CosmicRay has quit ["Leaving"]
m3ga has joined #ocaml
Herrchen has joined #ocaml
m3ga has left #ocaml []
velco has joined #ocaml
GreyLensman has quit ["Leaving"]
ez4 has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
cmeme has joined #ocaml
mlh has joined #ocaml
judge has quit [tolkien.freenode.net irc.freenode.net]
Nutssh has quit [tolkien.freenode.net irc.freenode.net]
dan2 has quit [tolkien.freenode.net irc.freenode.net]
dan2 has joined #ocaml
Nutssh has joined #ocaml
judge has joined #ocaml
Nutssh has quit [Excess Flood]
Nutssh has joined #ocaml
vezenchio has joined #ocaml
dan2 has quit [Excess Flood]
dan2 has joined #ocaml
Submarine has joined #ocaml
<Submarine> debugging on a Sunday morning
Tristram has quit [Remote closed the connection]
judge has quit [tolkien.freenode.net irc.freenode.net]
judge has joined #ocaml
Tristram has joined #ocaml
Submarine has quit ["ChatZilla 0.8.31 [Mozilla rv:1.4.1/20031114]"]
Nutssh has left #ocaml []
lmbdwr has quit [Read error: 232 (Connection reset by peer)]
mlh has quit [Client Quit]
cjohnson has joined #ocaml
cjohnson has quit [Client Quit]
cjohnson has joined #ocaml
cjohnson has quit ["The main attraction: distraction"]
docelic has joined #ocaml
<dan2> whats the ocaml type for the equivalent of FILE in C
<Smerdyakov> There is none. It distinguishes between different kinds of open files.
<Smerdyakov> There's an equivalent to file handles, as per open() & co., though.
<dan2> Smerdyakov: thats what I am looking for
pango has quit [Nick collision from services.]
pango has joined #ocaml
eugos has joined #ocaml
<dan2> Smerdyakov: whats the equivalent file handle
<Smerdyakov> I think it's in Unix.
<dan2> Unix.file_descr?
<Smerdyakov> But why aren't you happy with what's provided in Pervasives?
<dan2> Smerdyakov: because I need this for camlidl to work with some C types
<dan2> Smerdyakov: specifically functions that have arguments FILE*
<Smerdyakov> I don't think there is anything in the standard libraries equivalent to FILE*.
<dan2> that sucks
<Smerdyakov> No, it's nice.
<dan2> Smerdyakov: I guess I could use an abstract time
<dan2> type
<Smerdyakov> There's no reason to have the same type for both input and output channels.
<velco> there is, for full-duplex channels
<Smerdyakov> For those, you have a separate type.
<Smerdyakov> Or use two values to access it.
<pango> Smerdyakov: if they're buffered, last solution is probably not portable
<pango> (if used simultaneously)
cjohnson has joined #ocaml
eugos has left #ocaml []
srv has quit [Read error: 238 (Connection timed out)]
cjohnson has quit ["The main attraction: distraction"]
srv has joined #ocaml
kuribas has joined #ocaml
<kuribas> Does there exist a ocaml implementation for palm
<kuribas> If have seen caml-light for palm but it doesn't seem to work with newer palm API
fooli has quit [Read error: 110 (Connection timed out)]
kuribas has quit ["Leaving"]
monochrom has joined #ocaml
maml has joined #ocaml
<maml> hello
<maml> I have a parametrized module A:
<maml> module A = functor (K : Set.OrderedType) -> struct (** def ... **) end
<maml> It this module's definition, I'd like to use a "Set of K": Set.Make (K), is it possible ?
<Smerdyakov> What do you mean?
<maml> I want to do something like that:
<maml> arg, i don't find a simple example
<Smerdyakov> Well, I don't understand what you're asking, so I can't help unless you explain it.
<maml> i have a parametrize module A wich take a module K as argument.
<Smerdyakov> I know. What I don't understand is what you mean by "use."
<maml> In the definition of A i need to use values define in an other parametrized module B (like Set.Make) with the "K" argument
<Smerdyakov> In particular, I don't understand why you are asking this instead of using functors in the same way as they are always used.
<Smerdyakov> Can you tell me why the usual way of using functors doesn't work for you?
<Smerdyakov> I'm bothered by long pauses without responses. If you are off trying some things, could you please let me know?
<maml> sorry
<maml> i'm trying, but my ideas aren't very clear... And I've some difficulties with english.
<Smerdyakov> You should be able to use OCaml to express most of the important ideas.
<Smerdyakov> Do you understand how to use functors in general?
<maml> i'm not really sure
<Smerdyakov> OK. Have you read the manual to find out?
<maml> i explain my real problem.
<Smerdyakov> I'm not interested in your real problem if we've discovered that you don't know how to use functors.
<Smerdyakov> I have a feeling that your real problem is caused by that lack of understanding.
<monochrom> Smerdyakov's words are perhaps a bit harsh, but he has a point.
<Smerdyakov> maml, so I recommend you read the tutorial in the manual. (The part on functors in particular)
<maml> i have a module number: module type Number = sig type t val add : t -> t -> t val compare : t -> t -> int (* ... *) end and a module Infini (K: Number) = struct type t = Infiny | Number of K.t let add a b = match (a, b) with (Infiny, _) | (_, Infiny) -> Infiny | Number a, Number b -> K.add a b let compare a b = (* the def of compare *) end
<Smerdyakov> Please, don't go on without telling me one of two things first:
<Smerdyakov> Choice 1: I understand how to use functors in general.
<Smerdyakov> Choice 2: I don't understand how to use functors in general, so I am consulting the manual.
<maml> i think i understand how to use functors in general
<maml> but i'm still learning.
<Smerdyakov> OK. Can you explain how to use Set.Make, in general?
<maml> yes
<Smerdyakov> Please do so.
<maml> Ok :).
<maml> I want to make a Set of string for example.
<maml> So i have to define this module: module OrderedString = struct type t = string let compare = Pervasive.compare end
<maml> module SetOfString = Set.Make (OrderedString)
<Smerdyakov> OK. Now, what _specific_ trouble are you having adapting that pattern to your particular case?
<maml> Now, let ab = SetOfString.union (SetOfString.singleton "a") (SetOfString.singleton "b");;
<maml> hum
<maml> in this particular case, i want to use a Set of an "unknown" OrderedType
<Smerdyakov> Why is that a problem?
<maml> unknow because it is the parameter of my module.
<maml> I don't know the way to do this.
<maml> And i suspect there is no way.
<Smerdyakov> How do you make use of your functor's parameter, in general?
<maml> i use values declared in its signature.
<Smerdyakov> How?
<maml> with a "dot" :)
<Smerdyakov> OK. So, to access a member x of a top-level module M, you use: M.x
<Smerdyakov> To access a member x of a parameter module M, you use: M.x
<Smerdyakov> To instantiate functor F with top-level module M, you use: module N = F(M)
<Smerdyakov> How do you think you instantiate a functor with parameter module M?
<maml> module O = F(M) ?
<Smerdyakov> Yup!
<Smerdyakov> There is no difference between global modules and parameter modules.
<Smerdyakov> (in terms of how you use them)
<Smerdyakov> Just like "global" variables and function parameters are used the same way in OCaml.
<maml> Thanks you.
<maml> module A (K: OrderedType) = struct let f x = let module SetOfK = Set.Make (K) in SetOfK.singleton x end
<maml> ;;
<maml> this works.
<Smerdyakov> It probably doesn't work so well, though. Try using your functor.
<maml> module B = A (OrderedInt);;
<maml> B.f 3;;
<maml> - : Set.Make(OrderedInt).t = <abstr>
<maml> hum, it's work but ...
<maml> how can i use this set !
<Smerdyakov> Yup, that's the problem. :)
<maml> hum
<Smerdyakov> Do you see how your code only makes SetOfK available _inside_ the definition of f?
<maml> yes :)
<Smerdyakov> That is why you can't use it anywhere else.
<maml> but, i understand.
<maml> i just need a range of "SetOfK" in all A's definition
<maml> is it possible ?
<Smerdyakov> Sure, the same way you'd do that _outside_ a functor.
<Smerdyakov> SML doesn't even _have_ "let module," and this all works fine.
<maml> OutSide the functor K is "unbound" !
<Smerdyakov> So? You can refer to the contents of the functor's result.
<maml> I don't understand, can you give me an example without "let module" ?
<Smerdyakov> module A (K: OrderedType) = struct module SetOfK = Set.Make (K) let f x = SetOfK.singleton x end
ionOS has quit ["Leaving"]
<maml> Oh, i thought i can't declare a instantiate a funcor here !
<Smerdyakov> Inside a functor body, you can do _exactly_ what you can do at the top level.
<maml> Thank you, you've enlightened my mind, you were really patient.
<Smerdyakov> Indeed, every source file you write is implicitly inside a module definition when you use ocamlc or ocamlopt!
<maml> ok, i see
CosmicRay has joined #ocaml
<maml> Have a good night, all. And thanks again :).
maml has quit []
Herrchen has quit ["bye"]
velco has quit ["I'm outta here ..."]
kinners has joined #ocaml
cmeme has quit [Remote closed the connection]
cmeme has joined #ocaml
mlh has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
cmeme has joined #ocaml
vezenchio has quit ["None of you understand. I'm not locked up in here with you. YOU are locked up in here with ME!"]
jbm has joined #ocaml
CosmicRay has quit ["Leaving"]
bk_ has joined #ocaml
kinners has quit [Read error: 104 (Connection reset by peer)]