flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
LordMetroid has quit ["Leaving"]
palomer has quit [Remote closed the connection]
Morphous_ has joined #ocaml
Morphous has quit [Read error: 110 (Connection timed out)]
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
Ched- has quit [Connection timed out]
Ched- has joined #ocaml
er_ has joined #ocaml
sponge45 has quit ["see you at http://ocamlhackers.ning.com/"]
<vixey> How do you design a module system?
<Associat0r> vixey: ?
electronx has joined #ocaml
electronx has left #ocaml []
er_ has quit []
Snrrrub has joined #ocaml
Associat0r has quit []
seafood has joined #ocaml
RobertFischer has joined #ocaml
marmotine has quit ["mv marmotine Laurie"]
seafood has quit []
seafood has joined #ocaml
RobertFischer has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
Snrrrub has quit []
seafood has quit []
szell` has joined #ocaml
szell has quit [Connection timed out]
Associat0r has joined #ocaml
TypedLambda has joined #ocaml
Kopophex has quit ["Leaving"]
<tsuyoshi> hrm no bitmatch in debian yet
TypedLambda has quit ["Leaving..."]
filp has joined #ocaml
Sparkles has quit [clarke.freenode.net irc.freenode.net]
mfp has quit [clarke.freenode.net irc.freenode.net]
tsuyoshi has quit [clarke.freenode.net irc.freenode.net]
svenl has quit [clarke.freenode.net irc.freenode.net]
Sparkles has joined #ocaml
svenl has joined #ocaml
tsuyoshi has joined #ocaml
asmanur has joined #ocaml
bluestorm has joined #ocaml
mfp has joined #ocaml
mfp_ has joined #ocaml
mfp has quit [clarke.freenode.net irc.freenode.net]
Proteus has joined #ocaml
Associat0r has quit []
<bluestorm> hackish syntaxic sugar is sometimes cool :)
filp has quit ["Bye"]
mishok13 has joined #ocaml
hkBst has joined #ocaml
TypedLambda has joined #ocaml
LordMetroid has joined #ocaml
ChristopheT has joined #ocaml
ChristopheT has left #ocaml []
munga_ has quit ["Ex-Chat"]
TypedLambda has quit ["Leaving..."]
guillem has joined #ocaml
m3ga has joined #ocaml
seafood has joined #ocaml
ofaurax has joined #ocaml
filp has joined #ocaml
filp has quit [Read error: 104 (Connection reset by peer)]
bebex has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
sponge45 has joined #ocaml
<flux> is that type 'a t = 'a required there?
jlouis has joined #ocaml
<bluestorm> flux: not sure, but it wouldn't hurt
Christop` has joined #ocaml
asmanur has quit [Remote closed the connection]
asmanur has joined #ocaml
seafood has left #ocaml []
Christop` has left #ocaml []
seafood has joined #ocaml
bebex has quit [Read error: 110 (Connection timed out)]
kig has quit [Remote closed the connection]
redocdam has joined #ocaml
hsuh has joined #ocaml
redocdam has quit []
pango_ has quit [Remote closed the connection]
mishok13 has quit [Read error: 145 (Connection timed out)]
hsuh has quit [""restart to try wmiirc-lua""]
pango_ has joined #ocaml
mishok13 has joined #ocaml
seafood has quit []
lolfrenz has joined #ocaml
ocaml22 has joined #ocaml
kig has joined #ocaml
ocaml22 has quit [Client Quit]
ocaml22 has joined #ocaml
ocaml22 is now known as jony
jony is now known as jony1
jony1 is now known as DELL
DELL is now known as jony1
<jony1> salut
<jony1> quelqu'un peut m'aider comment je peut obtenier si j'ai un entier example 6 leur diviseur sous forme int list [1;2;3;6]
<jony1> merci davance
<Smerdyakov> This is an English channel.
<jony1> Smerdyakov
<jony1> if i have int for example 6 how i can do to get here divisor like int list [1;2;3;6]
<Smerdyakov> This is a homework question, right?
<jony1> its summer no homewark
<jony1> :)
<Smerdyakov> You're not in a class?
<jony1> im in holiday now
<jony1> its exercice
<jony1> im using modulo % but im not successing
<Smerdyakov> Well, I don't think you really want the answer to this question.
<Smerdyakov> You really want to learn about the OCaml fundamentals that would make it easy to answer yourself.
<Smerdyakov> And I'm not disposed right now to go through those fundamentals, so try asking questions about OCaml and not your specific problem if you want me (and like-minded others) to respond.
<jony1> LOL
<jony1> im asking the room
<jony1> not u
<Smerdyakov> Yup, and I'm predicting that you'll get better responses if you follow my advice.
<jony1> im just asking a question
<jony1> im joining here bcose only freenode have ocaml room on irc
<jony1> i dont use this server
<Smerdyakov> Yup, and you're asking your question the wrong way to get help.
<jony1> soory but im not english educated
<Smerdyakov> That isn't related to your problem here, I think.
<Smerdyakov> Like in all programming situations, specific questions are valued.
<Smerdyakov> Specific about what the asker really doesn't know.
<kig> let f n = unfoldrWhile (lessThan (n/2)) (fun x -> if n mod x == 0 then Some x else None) |> filter ((<>) None) |> map (fun x -> maybe 0 id x)
<kig> implementation of helper functions left to reader
<Smerdyakov> kig, quite an unhelpful answer, IMO.
<Smerdyakov> kig, now he will probably not take the time to learn how to ask questions properly for a while.
<jony1> ppfff im shiting up
<jony1> shuting*
TypedLambda has joined #ocaml
jony1 has left #ocaml []
<kig> i'm not happy with that solution though, there should be a skipping unfoldr + list of primes
<kig> unfoldrWhileSkipping (lessOrEqualTo (n/2)) (fun x -> if n mod x == 0 then Some (x, nextPrimeFrom x) else None) n
<kig> oh, but maybe question not prime factors of n
<kig> let factorise n = unfoldrWhileSkipping (lessOrEqualTo (n/2)) (fun x -> if n mod x == 0 then (Some x, x+1) else (None, x+1)) 1;;
<kig> factorise 144;;
<kig> - : int list = [72; 48; 36; 24; 18; 16; 12; 9; 8; 6; 4; 3; 2; 1]
tomh has joined #ocaml
<kig> more ugly, less iteration
<kig> let factorise n = let sn = n |> float |> sqrt |> int in unfoldrWhileSkipping (lessOrEqualTo sn) (fun x -> if n mod x == 0 then (Some (x, n/x), x+1) else (None, x+1)) 1 |> unzip |> uncurry (@) |> uniq;;
r0bby has quit [Client Quit]
Jeff_123 has joined #ocaml
<bluestorm> kig : let factorize = let rec div d n = if d * d > n then [n] else if n mod d = 0 then d :: div d (n / d) else div (d + 1) n in div 2
<bluestorm> wich is shorter and actually easier to read
<bluestorm> hmm
<bluestorm> on the other hand it only gives the prime factors
<bluestorm> it's not difficult to adapt to match your output, though
<bluestorm> (and i thought "factorize" should give the prime factors only anyway)
<kig> but that has no combinators in it (:
<bluestorm> combinators are not an end in themselves
<kig> all i need now is a camlp4 extension that transforms combinators into optimized recursions
<bluestorm> how would do achieve that by syntaxical transformations only ?
<bluestorm> (you mean stream fusion, don't you ?)
<kig> i mean, HOFs aren't inlined, so turning one into a macro should make it less jumpy, which might save half a dozen cycles per iteration
<bluestorm> ah
<bluestorm> so you only mean local inlining of |> and that
<kig> yeah
asmanur has quit [Remote closed the connection]
<bluestorm> that should not be too difficult, but how should such an extension be designed ?
<bluestorm> the obvious way is let inline (|>) .... = .. , but it's a bit invasive, isn't it ?
<bluestorm> hm
<bluestorm> moreover it would be quite difficult to have that working over multiple file
<kig> i don't really have a clue on that
<bluestorm> kig: if you wanted to, it would not be too difficult to create an extension that would inline operators, provided they are given at camlp4-time
<bluestorm> that is, you put the definition you want to inline in a separate file, wich is compiled to a .cmo and the given to camlp4
<bluestorm> the problem is that you could give definition that would not match the actual in-source value, thus silently changing your semantic
<bluestorm> the good side is that it's very non-invasive
lolfrenz has left #ocaml []
asmanur has joined #ocaml
Deffie has joined #ocaml
mib_r1u9br has joined #ocaml
Snrrrub has joined #ocaml
Deffie has quit []
asmanur_ has joined #ocaml
fake has joined #ocaml
asmanur has quit [Connection timed out]
wlmttobks has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
fake is now known as authentic
msandin has joined #ocaml
dellsuck1 has joined #ocaml
Deffie has joined #ocaml
mishok13 has quit [Read error: 104 (Connection reset by peer)]
wlmttobks has quit [K-lined]
Deffie has quit []
mishok13 has joined #ocaml
TypedLambda has quit ["Leaving..."]
LordMetroid has quit ["Leaving"]
Associat0r has joined #ocaml
jlouis has quit ["Leaving"]
tar_ has joined #ocaml
<tar_> How can I make a set of integers?
redocdam has joined #ocaml
<tar_> I don't know how to look up what I can use in " module IS = Set.Make(___);; "
<asmanur_> tar_: you need to give to Set.Make a module
Proteus_ has joined #ocaml
<Smerdyakov> tar_, do you understand the OCaml module system?
<Smerdyakov> tar_, and are you consulting the standard library reference in the OCaml manual?
Proteus has quit [Read error: 113 (No route to host)]
<tar_> Smerdyakov: Not very well yet.
<Smerdyakov> tar_, you can't answer "yes" to both of these questions if you are having the problem you are having. :)
<Smerdyakov> tar_, then I suggest going back and reading the relevant part of the tutorial in the manual.
<tar_> I am working from ocaml-tutorial.org and caml.inria.fr/pub/docs/manual-ocaml
<Smerdyakov> (This is distinct from ocaml-tutorial.org.)
<tar_> Am I right that there is no easy way of using the manual to find modules satisfying Set.OrderedType?
<Smerdyakov> No, you're wrong.
<tar_> Oh
<Smerdyakov> Oh, do you mean you want a list of modules in the standard library that satisfy that signature?
<tar_> Yea
<Smerdyakov> Any module whose name sounds like a monomorphic type probably does.
<flux> that kind of tool could be useful, though
<flux> but I suppose it would essentially mean having a compiler do it
<tar_> I expected Num to be Set.OrderedType, or Int32
<kig> module IntSet = Set.Make(struct type t = int let compare = (-) end)
<tar_> They are almost there, but the function is called compare_num instead of compare.
Snrrrub has quit []
<tar_> kig: thank you
<kig> http://caml.inria.fr/pub/docs/manual-ocaml/manual004.html read this for the details of what's going on
<kig> np
jlouis has joined #ocaml
<flux> it is not a good idea to use (-) for compare integer, because it can fail when you are at the ends of the range
<Smerdyakov> tar_, I think you are confused about [Int32]. Only [Num] has this silly naming convention.
<Smerdyakov> It is definitely a standard library omission not to have an [Int] module.
<tar_> Smerdyakov: Oh, yeah, I got that one wrong
marmotine has joined #ocaml
<Smerdyakov> kig, you should have just used [compare] instead of [(-)].
<kig> ah, the compiler turns compare into caml_int_compare
<kig> so, yes, compare'd be better
ofaurax has quit ["Leaving"]
guillem has quit [Remote closed the connection]
hsuh has joined #ocaml
msandin has quit ["Leaving."]
bluestorm has quit [Remote closed the connection]
Jeff_123 has quit [Read error: 104 (Connection reset by peer)]
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
tomh has joined #ocaml
hkBst has quit ["Konversation terminated!"]
netx303 has joined #ocaml
seafood has joined #ocaml
asmanur_ has quit [Remote closed the connection]
Jeff_123 has joined #ocaml
m3ga has joined #ocaml
sponge45 has quit ["see you at http://ocamlhackers.ning.com/"]
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
mib_r1u9br has quit [K-lined]