smimou changed the topic of #ocaml to: OCaml 3.08.3 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | 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/
Gueben has joined #ocaml
mikeX has joined #ocaml
mikeX has quit ["Leaving"]
ulfdoz has quit [brown.freenode.net irc.freenode.net]
zvrba has quit [brown.freenode.net irc.freenode.net]
mw has quit [brown.freenode.net irc.freenode.net]
cmeme has quit [brown.freenode.net irc.freenode.net]
det has quit [brown.freenode.net irc.freenode.net]
Mike_L has quit [brown.freenode.net irc.freenode.net]
cmeme has joined #ocaml
mw has joined #ocaml
Mike_L has joined #ocaml
det has joined #ocaml
zvrba has joined #ocaml
ulfdoz has joined #ocaml
zvrba has quit [Operation timed out]
mebaran151 has joined #ocaml
zvrba has joined #ocaml
ulfdoz has quit [Read error: 60 (Operation timed out)]
det has quit [Read error: 54 (Connection reset by peer)]
det has joined #ocaml
ulfdoz has joined #ocaml
ulfdoz has quit [brown.freenode.net irc.freenode.net]
ulfdoz has joined #ocaml
mebaran151 has left #ocaml []
ulfdoz has quit [brown.freenode.net irc.freenode.net]
ulfdoz has joined #ocaml
ulfdoz has quit [brown.freenode.net irc.freenode.net]
Gueben has quit [Remote closed the connection]
calvin_ has quit [Remote closed the connection]
calvin_ has joined #ocaml
ulfdoz has joined #ocaml
Smerdyakov has joined #ocaml
monochrom has quit [Remote closed the connection]
monochrom has joined #ocaml
<ulfdoz> bye
ChoJin has joined #ocaml
<ChoJin> hello
<ChoJin> simple question:
<ChoJin> $ cat foo.mli
<ChoJin> module type Foo =
<ChoJin> sig
<ChoJin> type foo
<ChoJin> end
<ChoJin> $ cat foo.mli
<ChoJin> module type Foo =
<ChoJin> sig
<ChoJin> type foo
<ChoJin> end
<ChoJin> $ cat foo.mli
<ChoJin> module type Foo =
<ChoJin> sig
<ChoJin> type foo
<ChoJin> end
<ChoJin> $ cat foo.mli
<ChoJin> module type Foo =
<ChoJin> sig
<ChoJin> type foo
<ChoJin> end
<ChoJin> oops
<ChoJin> sorry
<ChoJin> and I have my foo.ml
<ChoJin> $ cat foo.ml
<ChoJin> module Foo =
<ChoJin> struct
<ChoJin> type foo = {name:string}
<ChoJin> end
<ChoJin> when I compile I get that:
<ChoJin> The implementation foo.ml does not match the interface foo.cmi:
<ChoJin> The field `Foo' is required but not provided
<ChoJin> any idea?
<Smerdyakov> That's right.
<Smerdyakov> foo.mli contains a module type, while foo.ml contains a module.
<ChoJin> what's the difference?
<ChoJin> I thought type was going with "sig"
<Smerdyakov> The same as the difference between int and 27.
<Smerdyakov> Have you used Standard ML?
<ChoJin> no
<Smerdyakov> "module type" declares the type of a module.
<Smerdyakov> It does not declare the type of the module with the same name in the corresponding .ml file.
* Smerdyakov rephrases his second-last line.
<Smerdyakov> "module type" declares a name for a signature.
<ChoJin> ok
<ChoJin> So, how do I specify in my .ml that my module Foo follow the module type Foo?
<Smerdyakov> I don't know.
<Smerdyakov> In SML, you put "structure S : SIG" inside a signature to specify the presence of a structure S ascribing to SIG.
<Smerdyakov> I couldn't vouch for the exact OCaml syntax.
noj has quit [brown.freenode.net irc.freenode.net]
noj has joined #ocaml
Smerdyakov has quit ["sleep"]
threeve has quit []
_fab has joined #ocaml
<zvrba> hi people.. I have some quoestions
<zvrba> 1: about the signatures. say I have a signature sig type x = ... end;;
<zvrba> and I have a module implementing an "extended" signature like sig type x = ... type y = ... end
<zvrba> is the module with the "extended" signature considered to have the first, more restricted, signature?
<zvrba> i.e. can it be used with functors expecting more restricted signature
__DL__ has joined #ocaml
monochrom has quit ["good morning, sweet dream"]
Nutssh has joined #ocaml
ChoJin has quit [Read error: 110 (Connection timed out)]
petter_ has joined #ocaml
mlh_ has quit [Client Quit]
Snark has joined #ocaml
_fab has quit [Remote closed the connection]
Nutssh has quit ["Client exiting"]
noj has quit [brown.freenode.net irc.freenode.net]
noj has joined #ocaml
<ulfdoz> re
noj has quit [brown.freenode.net irc.freenode.net]
noj has joined #ocaml
vezenchio has joined #ocaml
Gueben has joined #ocaml
GuebN has joined #ocaml
Gueben has quit [Read error: 110 (Connection timed out)]
joeytwiddle has joined #ocaml
threeve has joined #ocaml
moea has joined #ocaml
<moea> how do i go about making a dictionary?
<moea> presumably with Map.Make, or somesuch, but i dont know what i'm doing
<Snark> moea: maybe an association list?
<Snark> module List
<moea> Snark: thanks
<Snark> no problem
<Snark> got confused by it too, back then ;-)
<moea> :)
<moea> is there a pattern i can put in a "match" statement that would match both [] and x::xs ?
<moea> so, any list, basically
<Snark> yes
<Snark> match list with some_name -> ...
<Snark> ie: no matching
<moea> Snark: thanks,
<moea> Snark: sorry, i've got a match clause, and i want to execute something different depending on the type, at the moment its "match x with list -> 22 | int -> 23"
<moea> but that always returns 22
<Snark> moea: that doesn't work
<Snark> you'll have to do define your type as Int of int | Float of float | etc
<Snark> then match on it
<moea> ah, i get it! thanks!
<zvrba> Snark! hi! :)
<zvrba> i have some quick questions
<zvrba> 1. is it possible for a functor to have more than one parameter?
<Snark> no idea
<Snark> hopefully yes
<zvrba> all examples I have seen take only one argument
<zvrba> ok.. I have some doubts about signatures
<Snark> examples in documentation have a high tendancy to be simple... if not simplistic
<zvrba> if a functor is accepting some signature.. will it also accept modules having a signature which is a SUPERSET of the one required by the functor?
<det> yes
<zvrba> ok.
<det> Or else you couldnt do things like Set(String)
<zvrba> next, thing (I guess I could test this myself, but maybe I'll get a deeper answer)
<zvrba> suppose you have type my_type = int ;;
<zvrba> and you declare function val f: my_type -> my_type ;;
<zvrba> will f 3 work?
<zvrba> i.e. is type equality a structural one or name-based?
ChoJin has joined #ocaml
<zvrba> i'm asking because I know of some languages (e.g. Ada) where structurally equivalent types (my_type and int) are not convertible
<det> it will work
<det> but module asciption is different
<det> IIRC
<zvrba> what do you mean?
<det> # module type S = sig type t val f: t -> t end;;
<det> module type S = sig type t val f : t -> t end
<det> # module M : S = struct type t = int let f x = x + 1 end;;
<det> module M : S
<det> # M.f 2;;
<det> This expression has type int but is here used with type M.t
ChoJin has quit ["Leaving"]
<zvrba> hmm.. interesting
<det> I forget Ocaml
<moea> sorry for the stupidity, i have a function should accept lists of integers, or integers. i have "type acceptable = List of acceptrable list | Int of int"
<det> I know SML has two kinds of ascription
<zvrba> but isn't it because t is abstract in S? and OCaml doesn't know how to tie it with int in M
<moea> and in the function, i have let f t = match t in Int i -> 21 | List l -> 22;;
<moea> but i get an error
<det> zvrba, yes, but in SML using transparent ascription it would use structual equivalence
<det> zvrba, I dont know if Ocaml has something similar
<zvrba> ahaa... ok. thanks :)
saccade has joined #ocaml
<det> moea, Why would you need a function like that?
<Snark> moea: shouldn't it be type acceptable = List of int list | Int of int ?
<moea> det: its a minimal example of something larger i'm trying to do
<moea> Snark: i'm going to add more types on the end
<Snark> it will be a recursive type?
<moea> Snark: yes
<saccade> having installed the OCaml package for mac os x, I can't find any of the files
<saccade> where would I look for executables?
<moea> i call my function: "f 2" but i get an error that the expression has type int but is here used with type acceptable
<Snark> moea: try "f (Int 2)"
<moea> Snark: that works!
<moea> what type is "2" when it's unadorned?
<moea> the interpreter says its an int
<Amorphous> moea: but (Int 2) is not an int, right?
<moea> what is it then?
<Snark> moea: an acceptable...
<Snark> so f can act on it
<moea> Snark: acceptable contains "Int" though, and isn't a "2" by itself an Int?
<Snark> no
<Snark> 2 is an int
<Snark> and you didn't create a "Int" type
<Snark> you created a type "Int of int"
<moea> what does that mean exactly?, the "of int" part
<Snark> that means that if you have an int, you can use it to build an acceptable
maw has joined #ocaml
<moea> thanks
* Snark isn't sure the explanation was that clear
<moea> its a bit confusing :)
maw has left #ocaml []
<Snark> think of Int as a builder for "acceptable", taking an "int" as argument
<moea> that makes sense
GuebN is now known as Gueben
Gueben is now known as Guebenhop
Guebenhop is now known as Gueben
<moea> it is possible to have a function return two different types in two different sets of conditions? like List l -> (1,2) | Int i -> 1
<moea> (sorry, i'm new to FP type-systems)
<Snark> no
<Snark> of course
<Snark> ocaml is strongly typed
<Snark> you'll have to do the same as above...
<moea> thanks
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
<zvrba> one design-related question
<zvrba> when do you use functors and when it is more appropriate to use function arguments as callbacks?
<zvrba> today I have implemented a breadth-first -search
<zvrba> si I was thinking a) I could define a signature for the state or b) pass state-related functions as arguments to BFS
<zvrba> I've chosen b)
<zvrba> ok, I could make search into functor and instantiate it either with stack or queue, thus getting either DFS or BFS
<zvrba> but I'd like to hear other opinions..
<zvrba> about the general usage patterns
saccade has quit ["This computer has gone to sleep"]
mfurr is now known as mfurr_vac
<moea> does ocaml have any functions for converting numbers between bases?
<moea> like b10 -> b128 or whatever
<mauke> I don't know; let me check the docs for you
<moea> im checking in the "Num" module libref, i cant see anything
<mauke> isn't Num for bignums?
<moea> maybe
ChoJin has joined #ocaml
<ChoJin> hello
<mauke> hmm, can't find anything besides printf and scanf
monochrom has joined #ocaml
_DL_ has joined #ocaml
__DL__ has quit [Read error: 110 (Connection timed out)]
saccade has joined #ocaml
<saccade> where do I look for the executable files for ocaml in os x?
<Snark> saccade: doesn't MOSX install things in a single directory?
<saccade> nope
<saccade> it depends a lot on the application
<Snark> saccade: find(1) ?
<Snark> (sorry)
<saccade> tried that
<saccade> it really doesn't seem to be in the directory structure
rossberg has quit [brown.freenode.net irc.freenode.net]
rossberg has joined #ocaml
Snark has quit ["Leaving"]
petter_ has quit [Read error: 110 (Connection timed out)]
_DL_ has quit [Remote closed the connection]
Enveigler_ has joined #ocaml
Enveigler_ has left #ocaml []
threeve has quit []
saccade has quit ["This computer has gone to sleep"]
jcowan has joined #ocaml
<jcowan> I'm looking for common applications of parametric polymorphism that don't involve collections of things.
jcowan has left #ocaml []
threeve has joined #ocaml
<monochrom> the fallacy in that question is if you replace "parametric polymorphism" by anything you get pretty much the same answer.
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
vezenchio has quit ["\o/ in mochintin namocniuh \o/"]