adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml-lang.org | Public logs at http://tunes.org/~nef/logs/ocaml/
mye_ has joined #ocaml
mye has quit [Ping timeout: 240 seconds]
mye_ is now known as mye
watermind has quit [Quit: Konversation terminated!]
suyu has quit [Quit: suyu]
suyu has joined #ocaml
suyu has quit [Quit: suyu]
tac has quit [Quit: Page closed]
madroach has quit [Ping timeout: 244 seconds]
hcarty has quit [Ping timeout: 255 seconds]
hcarty has joined #ocaml
madroach has joined #ocaml
suyu has joined #ocaml
tane has joined #ocaml
tane has quit [Quit: Verlassend]
fantasticsid has joined #ocaml
nickmeharry has quit [Quit: Leaving.]
Yoric has joined #ocaml
fantasticsid has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
hcarty has quit [Ping timeout: 255 seconds]
hcarty has joined #ocaml
q66 has quit [Quit: Quit]
Yoric has quit [Ping timeout: 252 seconds]
ontologiae has joined #ocaml
wormphle1m has quit [Ping timeout: 255 seconds]
<pippijn> wmeyer: you can also just return pointers cast to value
wormphlegm has joined #ocaml
<pippijn> the GC won't touch it
<pippijn> custom block is for GC'able C pointers
milosn has quit [Ping timeout: 255 seconds]
milosn has joined #ocaml
lolcathost has joined #ocaml
ontologiae has quit [Ping timeout: 265 seconds]
Yoric has joined #ocaml
pkrnj has quit [Quit: Computer has gone to sleep.]
weie has joined #ocaml
pkrnj has joined #ocaml
tac has joined #ocaml
gour has joined #ocaml
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
ontologiae has joined #ocaml
eni has joined #ocaml
ontologiae has quit [Ping timeout: 245 seconds]
tac has quit [Quit: Page closed]
tac has joined #ocaml
Kakadu has joined #ocaml
milosn has quit [Ping timeout: 255 seconds]
milosn has joined #ocaml
wormphlegm has quit [Read error: Connection reset by peer]
wormphlegm has joined #ocaml
eni has quit [Ping timeout: 264 seconds]
mcclurmc has quit [Ping timeout: 245 seconds]
cdidd has joined #ocaml
eni has joined #ocaml
tac has quit [Ping timeout: 245 seconds]
cdidd has quit [Ping timeout: 245 seconds]
cdidd has joined #ocaml
suyu has quit [Quit: suyu]
cdidd has quit [Ping timeout: 252 seconds]
cdidd has joined #ocaml
cdidd has quit [Read error: Connection reset by peer]
jewel has joined #ocaml
myx has joined #ocaml
yezariaely has quit [Quit: changing servers]
yezariaely has joined #ocaml
asmanur_ has joined #ocaml
asmanur has quit [Ping timeout: 265 seconds]
RagingDave has joined #ocaml
julm has joined #ocaml
q66 has joined #ocaml
BiDOrD_ has joined #ocaml
milosn has quit [Ping timeout: 276 seconds]
milosn has joined #ocaml
BiDOrD has quit [Ping timeout: 252 seconds]
|jbrown| has quit [Read error: Connection reset by peer]
suyu has joined #ocaml
suyu has quit [Client Quit]
Kakadu has quit [Ping timeout: 245 seconds]
Kakadu has joined #ocaml
lolcathost has quit [Ping timeout: 264 seconds]
tane has joined #ocaml
xavierm02 has joined #ocaml
<xavierm02> Does this definition of my boolean_expression type seem reasonable?
<xavierm02> happy new year btw
ontologiae has joined #ocaml
<asmanur_> xavierm02: why do you want to enforce canonicality/cnf while building the tree ?
<xavierm02> I don't
<xavierm02> but I want to have a single type
<xavierm02> to represent both canonical and non canonical expressions
<xavierm02> so that I can use functions that don't need it on either
<xavierm02> and can specify it has to be canonical for some other functions
<asmanur_> but at the moment, you cannot build canonical expressions, can you ?
<wmeyer> xavierm02: good point by asmanur_, but I quite like your GADT :-)
<xavierm02> I don't need to build canonical expressions
<xavierm02> I'll have a function that makes expressions canonical
<asmanur_> it will have to use Obj.magic then
<xavierm02> hm
<asmanur_> i'd rather have 'canonical and 'cnf be phantom
<asmanur_> and you hide your constructors and you provide safe functions binop : ... to the user
<asmanur_> otherwise you will have to use Obj.magic all the time
<xavierm02> hm
<xavierm02> I'll look into it
<xavierm02> ty :)
<xavierm02> is there really no way
<xavierm02> to have an "intelligent" constructor
<xavierm02> that would know
<xavierm02> cnf + or + cnf -> cnf
<xavierm02> _ + _ + _ -> not_cnf
<xavierm02> etc?
<asmanur_> you can do a constructor
<asmanur_> for each rule :)
<xavierm02> yeah
<xavierm02> but then filtering becomes a pain in the ass
<xavierm02> :/
<asmanur_> what you can do
<asmanur_> is
<asmanur_> type ('a, 'b) private exp = ... (* untyped constructors *)
<asmanur_> and then provide a function per constructor
<xavierm02> hm
<xavierm02> so like
<xavierm02> two constructors in the type
<xavierm02> and a function that dispatches to those two constructors?
<asmanur_> no
<asmanur_> one constructor in the type
<asmanur_> and two functions
<asmanur_> the private (i think it's right) allows the user only to match
<asmanur_> against this type
<asmanur_> not to build
<asmanur_> the problem is that when you will match you will loose typeness :/
<asmanur_> depends on what you are aiming :)
<xavierm02> but
<xavierm02> isnt two construdctors and one function a good idea?
<xavierm02> or maybe
<xavierm02> two constructors
<xavierm02> two functions
<xavierm02> one function that dispatches to both constructors
<xavierm02> and the publioc one allowing only one constructor
<fasta> Is there any library which takes an URL and returns the domain?
<adrien> like: http://www.example.com/about.html -> example.com ?
<fasta> adrien: like: http://anonscm.debian.org/gitweb/?p=amavisd-new/pkg-amavisd-milter.git;a=summary => www.example.com with probably also the protocol parsed in some structure, etc.
<fasta> adrien: er anonscm.debian.org
<adrien> look at ocamlnet
<adrien> and I think there's something around mirage too
<adrien> there's an RFC for URI schemes and I know there are a couple implementations
tww has joined #ocaml
<xavierm02> can't I do somethign like this
<xavierm02> type 'canonical boolean_expression =
<xavierm02> | Var_Canonical : int -> canonical boolean_expression
<xavierm02> | Var_NotCanonical : int -> not_canonical boolean_expression
<xavierm02> ;;
<xavierm02> let var_ = function
<xavierm02> | 0 -> Var_Canonical 0
<xavierm02> | (i:int) -> Var_NotCanonical i
<xavierm02> ;;
Snark_ has joined #ocaml
<xavierm02> ?
Snark_ is now known as Snark
<xavierm02> nm
<xavierm02> it works by using
<xavierm02> | Var_NotCanonical : int -> _ boolean_expression
<xavierm02> I have no idea what I'm doing T.T
<asmanur_> why the first thing does not work ?
tww has quit [Quit: tww]
<asmanur_> what you can do is also
<asmanur_> hm
<xavierm02> | Var_NotCanonical : int -> not_canonical boolean_expression
<xavierm02> doesnt work
<xavierm02> because then the function returns two different types
<xavierm02> aparently
<xavierm02> but the _ fixes it
<xavierm02> somehow
<xavierm02> no idea why though
<asmanur_> yes
<asmanur_> because
<asmanur_> what is the type of var_ ?
<xavierm02> 'a boolean_expression -> 'b boolean_expression
<xavierm02> i think
<xavierm02> it should be
<asmanur_> hm
<asmanur_> it takes an int ?
<xavierm02> yeah
<xavierm02> right >_<
<xavierm02> int -> 'a boolean_expresion
<asmanur_> then since 'a is phantom anyay it is useless
<xavierm02> yeah
<xavierm02> but it does what I want
<xavierm02> type binary_operator = And | Or;;
<xavierm02> (* canonical means the ints representing the variables range from 0 to (n-1) where n is the number of variables *)
<xavierm02> type canonical;;
<xavierm02> type not_canonical;;
<xavierm02> (* cnf means the expression is in conjunctive normal form *)
<xavierm02> type cnf;;
<xavierm02> type not_cnf;;
<xavierm02> type ('canonical, 'cnf) boolean_expression =
<xavierm02> | Var_Canonical : int -> (canonical, not_cnf) boolean_expression
<xavierm02> | Var_NotCanonical : int -> (_, not_cnf) boolean_expression
<xavierm02> ;;
<xavierm02> let var_ = function
<xavierm02> | 0 -> Var_Canonical 0
jpdeplaix has quit [Ping timeout: 265 seconds]
<xavierm02> | (i:int) -> Var_NotCanonical i
<xavierm02> ;;
<xavierm02> let is_cnf = function
<xavierm02> | Var_Canonical _ -> 1
<xavierm02> | _ -> 0
tww has joined #ocaml
<xavierm02> ;;
<xavierm02> print_int (is_cnf(var_ 0));(*0*)
<xavierm02> print_int (is_cnf(var_ 1));(*1*)
tww has quit [Client Quit]
<xavierm02> since I still have the constructors
<xavierm02> I can determine if it is canonical
jpdeplaix has joined #ocaml
<asmanur_> yes that's right
<xavierm02> ok
<xavierm02> it does make the type completely useless
<xavierm02> var_ is
<xavierm02> int -> (canonical, not_cnf) boolean_expression
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 264 seconds]
ulfdoz_ is now known as ulfdoz
<fasta> How can I find which package contains a given module? In case of multiple results, it should just list all of the candidates.
<fasta> I already hacked up something that seems to work in common cases.
eni has quit [Ping timeout: 240 seconds]
ontologiae has quit [Ping timeout: 245 seconds]
ontologiae has joined #ocaml
ontologiae has quit [Ping timeout: 260 seconds]
myx has quit [Ping timeout: 260 seconds]
eni has joined #ocaml
myx has joined #ocaml
emmanuelux has joined #ocaml
milosn has quit [Ping timeout: 245 seconds]
milosn has joined #ocaml
milosn has quit [Remote host closed the connection]
milosn has joined #ocaml
mcclurmc has joined #ocaml
jewel has quit [Ping timeout: 240 seconds]
<troydm> can i have a polymorphic type record in ocaml
<troydm> something like
<troydm> type a' myrec = { x: a' }
<troydm> i guess i can't :(
<wmeyer> yes, of course you can. Put ' before the a
<troydm> it doesn't compiles
<troydm> i mean i've put
Snark has quit [Quit: Quitte]
<troydm> type 'a object = { object: 'a }
<flux> object is a keyword
<flux> I think..
<xavierm02> yup
<flux> yep, that's it
<troydm> oic
<troydm> thx
fraggle_ has quit [Ping timeout: 260 seconds]
shp has joined #ocaml
<shp> hi
<shp> i can't manage to get random floats in caml light: i use random__float(1.) for instance to get a random number but it always the same that come at first. I have written "random__init;;" before but there's no difference
jamii has joined #ocaml
<wmeyer> well, it's a pseudo-random generator not real one. It's deterministic. Your call to random_init is not a call, perhaps you need to do: random_init 123;;
<shp> but it's the same case, the first random will always be the same with random__init 123;;
<shp> and caml light does not seem to have implemented a time() function
<wmeyer> yes, it will be the same, and that is expected always.
<wmeyer> libc does it in the same way
<wmeyer> you want to be able to reproduce the results with the same seed
<shp> it feels like i'm gonna install ocaml
<wmeyer> shp: great idea!
<shp> i have a 60 lines caml light code, do you think it will be a big hardship to make it work in ocaml ?
<wmeyer> no, it should be OK
<shp> i'm on linux, "ocaml < and.ml " seems to act up, is there an "official" equivalent ?
<flux> shp, ocaml and.ml? but maybe you want ocamlscript
<flux> (but I have done without, just put #!/usr/bin/ocaml at the top of the file and run with it)
<shp> lol i'm a little twisted sometimes
<shp> ty flux
<shp> is it possible to make "ocaml" binary more verbose ? because it just tells me there is a syntax error line 4 and it does not precise me which instruction
<shp> no vectors in ocaml ?!?!?
<shp> only lists?
jbrown has joined #ocaml
<Kakadu> there a arrays
ontologiae has joined #ocaml
weie has quit [Quit: Leaving...]
gustav__ has joined #ocaml
<wmeyer> shp: [|"look";"into";"manual"|]
Kakadu has quit []
gour has quit [Quit: WeeChat 0.3.8]
Oejet has joined #ocaml
eni has quit [Quit: Leaving]
Yoric has quit [Ping timeout: 252 seconds]
Oejet has quit [Ping timeout: 255 seconds]
hcarty has quit [Ping timeout: 244 seconds]
hcarty has joined #ocaml
tani has joined #ocaml
tane has quit [Ping timeout: 245 seconds]
shp has quit [Quit: kit]
Oejet has joined #ocaml
jbrown has quit [Remote host closed the connection]
RagingDave has quit [Quit: Ex-Chat]
oriba has joined #ocaml
suyu has joined #ocaml
tani has quit [Quit: Verlassend]
tac has joined #ocaml
tac has quit [Quit: Page closed]