bacam has quit [Read error: 60 (Operation timed out)]
bacam has joined #ocaml
faigo has joined #ocaml
mlh has joined #ocaml
threeve has joined #ocaml
smimou has quit ["?"]
mflux has joined #ocaml
tom_p has quit [zelazny.freenode.net irc.freenode.net]
z|away has quit [zelazny.freenode.net irc.freenode.net]
Mike_L 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]
mflux_ has quit [zelazny.freenode.net irc.freenode.net]
haakonn has quit [zelazny.freenode.net irc.freenode.net]
threeve has quit [Read error: 110 (Connection timed out)]
z|away has joined #ocaml
tom_p has joined #ocaml
Mike_L has joined #ocaml
mellum has joined #ocaml
haakonn has joined #ocaml
oracle1 has joined #ocaml
Smerdyakov has joined #ocaml
<twobitsprite>
how can one make mutually recursive types?
<sethk>
twobitsprite, I believe you have to use mutually recursive modules
<Smerdyakov>
No.
<Smerdyakov>
twobitsprite, read the part of the manual that talks about type definitions.
pnou_ has quit [Read error: 104 (Connection reset by peer)]
Banana has quit [Read error: 104 (Connection reset by peer)]
pnou has joined #ocaml
Banana has joined #ocaml
luqui has joined #ocaml
xidaux has joined #ocaml
xidaux has quit ["leaving"]
Schmurtz has quit [Read error: 110 (Connection timed out)]
<twobitsprite>
Smerdyakov: in "the core language"?
luqui has left #ocaml []
<Smerdyakov>
Yes
ellisonch has joined #ocaml
<ellisonch>
i love ocaml!!
<twobitsprite>
ellisonch: care to elaborate?
<ellisonch>
sure. i am having a generally sucky semester, but i have a programming languages and compilers class where i'm learning ocaml, and it is the highlight of my week. even the homework is fun to do
<twobitsprite>
ellisonch: I'm having fun programming in OCaml myself, but after being exposed to the type system of Haskell, and the pattern matchin of SML, OCaml has some superfluous aspects...
<ellisonch>
i have never tried haskell
<twobitsprite>
it's an amazin language! (until you try to do anything realistic in it)
<twobitsprite>
Smerdyakov: I see a section that talks about recursive types, but nothing about mutually recursive types...
<ellisonch>
interestingly enough, some real life programs have been made with ocaml, specifically a multi-network P2P program (which i found by the wikipedia article on ocaml)
<Smerdyakov>
twobitsprite, I'll look.
<Smerdyakov>
ellisonch, oh, I meant the language reference, not the tutorial.
<Smerdyakov>
No, look at where it appears in the TOC. That's the tutorial.
<Smerdyakov>
Or the "Introduction."
<twobitsprite>
ellisonch: yeah, OCaml is a much more useful language than haskell, I just wish I could combine the elegance of Haskell with the practicallity of OCaml...
<Smerdyakov>
Part II is your language reference.
<Smerdyakov>
twobitsprite, which inelegances are on your mind?
<twobitsprite>
Smerdyakov: mostly syntactical and superficial...
<ellisonch>
i don't like how you can make tuples without using parenthases :)
<ellisonch>
but generally i think it looks cool
<twobitsprite>
Smerdyakov: I feel like the type system of Haskell is a bit mor expressive... I feel like OCaml has a bit more of a cludgy type system...
<Smerdyakov>
twobitsprite, Haskell 98 is a little more expressive, but only through type classes, as far as I know.
<Smerdyakov>
twobitsprite, ghc extensions add a lot, however.
<twobitsprite>
ellisonch: well... "," is te tuple constructor, just like "::" is the list constructor... the parens are just to isolate the tuple as a subexpression... IIRC...
<twobitsprite>
Smerdyakov: also, SML/Haskell have much more convenient pattern matching...
<Smerdyakov>
twobitsprite, how is that?
<ellisonch>
yes but sometimes i write [1,2,3] when i mean to make a list of three integers
<twobitsprite>
Smerdyakov: the fact that I have to use two keywords to perform a pattern match in OCaml, whereas haskell and SML will dismantle/match any of the constructs passed to it in the argument list...
<Smerdyakov>
twobitsprite, see 'function' in OCaml.
<twobitsprite>
Smerdyakov: yes, but I have to say "let f = function x -> ..." as opposed to "fun f x = ... | f x = ..." in SML
<Smerdyakov>
twobitsprite, and that's worse? The SML version is more verbose.
<twobitsprite>
Smerdyakov: *shrugs* like I said, mostly superficial complaints... I just feel that the SML is more pleasing to the(/my) eye...
<twobitsprite>
Smerdyakov: ... in certain ways, mind you... for the most part I'm much happier in OCaml, but there are certain aspects of SML that might drive me to learn camlp4 to implement in OCaml :P
<Smerdyakov>
ellisonch, after you've become a seasoned MLer, you should learn something about the world of computer proof assistants, whence ML came. :)
<twobitsprite>
wasn't the first Haskell implementation writen in ML?
<ellisonch>
heh well, one of my other classes is about program verification, where we will be learning maude
<Smerdyakov>
twobitsprite, that would make sense.
* twobitsprite
googles maude
<ellisonch>
but it's very difficult to understand. i feel like the professor gets too bogged down in notation and ignores the forest for the trees
<Smerdyakov>
I don't know Maude. I use Coq.
<ellisonch>
well the professor wrote maude, so...
* twobitsprite
googles Coq...
<Smerdyakov>
I don't have a sense for how "advanced" Maude is.
<Smerdyakov>
But Coq is the mack daddy of proof assistants.
<Smerdyakov>
I need to learn more about the competition, to verify if I am correct in saying that. :)
<twobitsprite>
ahh... rewriting logic engines...
<ellisonch>
smerdy, why is your whois hostname so weird?
<Smerdyakov>
ellisonch, look around. You'll find many others. There are various ways to get vanity "cloaks" on Freenode.
<ellisonch>
what is one way?
<Smerdyakov>
twobitsprite, Coq is definitely not a "rewriting logic engine." It's much more. Maude might be, though.
<Smerdyakov>
ellisonch, donate to Freenode during the annual fundraiser.
<ellisonch>
gotcha
faigo has quit ["Leaving"]
z|away has left #ocaml []
pango_ has joined #ocaml
pango has quit [Read error: 145 (Connection timed out)]
aegray has joined #ocaml
humasect has joined #ocaml
Snark has joined #ocaml
sethk has quit [Remote closed the connection]
__DL__ has joined #ocaml
<twobitsprite>
is there a reason for distinguishing "let" from "let rec"?
<twobitsprite>
some tutorial said that "let rec" is no more expensive than "let"... I'm trying to think of a situation where "let" would be more useful than "let rec"...
<mflux>
let x = 42 in let x = x + 3 in ..
<twobitsprite>
mflux: I just see that as bad programming practice... "let x = 42 in let y = x + 3 in ..." seems more reasonable to me...
<mflux>
sometimes you want to do that many times and you don't want to invent new names
<twobitsprite>
hmm...
<mflux>
I plainly don't think its better to write let sample = read_sample "file" in let sample2 = filter_low sample in let sample3 = filter_high sample2 in let sample4 = crop_sample sample3 in sample4
<mflux>
it is much easier to accidently use an older binding when you don't reuse the labels in such cases
<twobitsprite>
I guess so...
<mflux>
also you can just insert a new stage after any of those definitions without having to rewrite the rest of the function..
<twobitsprite>
hmm... in "let x = 42 in let x = x + 3 in ..." is the previous x garbage-collected after the label has been reused?
<mflux>
well, actually just rewriting the next stage is sufficient if you don't want to stick to a certain naming convention
<mflux>
yes
<mflux>
well, eventually
<mflux>
it doesn't really differ from .. let y = x + 3 case
<twobitsprite>
ahh
<mflux>
the compiler can see if the specific x is going to be used later or not
<twobitsprite>
also, the reference says that "let ... in ..." introduces a new scope... is there a way to leave that scope? i.e. "let ... in ... end"?
<mflux>
you can do begin let ... in .. end
<mflux>
or just (let ..)
<twobitsprite>
ahh I guess so...
<twobitsprite>
but then you would also have to use the ";" at the end of "end" (or the ")") in order to do something after you left that scope...
<mflux>
yes, I think doing that is rare
<mflux>
usually the scopes are limited by the syntax
<mflux>
let value = let a = 42 in a + 4 in ..
<mflux>
the scope of 'a' terminated at the last 'in'
<twobitsprite>
heh... I've never thought of nesting a let inside of a let like that :P
<mflux>
it's very useful
<twobitsprite>
I bet... I bet it's also very confusing...
<mflux>
if the code is indented properly, I don't think so
<twobitsprite>
I would put ( .. ) around the inner let...
<mflux>
well, the code might look even like:
<mflux>
let value = let conv x = x + 1 in List.map conv somelist in ..
<mflux>
you could use parenthesis or you could just indent the inner let
<mflux>
(and List.map)
<mflux>
so like; let value =\n let conv x = x + 1 in\n List.map conv somelist in\n
<twobitsprite>
I have a hard time rellying on operater precidence unless it's obvious or simple... I'm a bit OCD with parens... :P
avlondono has quit [Read error: 110 (Connection timed out)]
<mflux>
but I'm off to the office, back to the irc there ;) ->
<twobitsprite>
hmmm... can you do pattern matching in lets? i.e.: let h :: t = alist in ...?
<twobitsprite>
ahh, ok later
ski has joined #ocaml
<mflux>
back.
<mflux>
yes
<mflux>
but that will cause a compiler warning
mfurr has quit [Read error: 110 (Connection timed out)]
<haakonn>
hmm. what is the syntax for making a new record value based on an existing one but with one value changed?
<mflux>
let v2 = { v1 with a = 42 }
<haakonn>
ah, thanks
<haakonn>
forgot the braces
pango_ has quit [Remote closed the connection]
mlh has quit [Client Quit]
pango has joined #ocaml
Snark has quit ["Leaving"]
jynxzero has joined #ocaml
gim has quit ["brb"]
Revision17 has joined #ocaml
ski_ has joined #ocaml
ski has quit [Read error: 110 (Connection timed out)]
gim has joined #ocaml
Skal has joined #ocaml
revision17_ has quit [Read error: 110 (Connection timed out)]
m3ga_ has joined #ocaml
Schmurtz has joined #ocaml
vezenchio has quit [""The law, in its majestic equality, forbids the rich as well as the poor to sleep under bridges, to beg in the streets, and to"]
m3ga_ is now known as m3ga
ski_ is now known as ski
mfurr has joined #ocaml
Gueben has joined #ocaml
humasect has quit ["Leaving.."]
TeXitoi has quit ["Lost terminal"]
_fab has joined #ocaml
<haakonn>
hmmm. do you think it is possible to write a singly-linked list (with O(1) append) without side-effects like mutable record fields or references?
<pango>
they're implementations of Fifos with two lists, and an amortized cost in O(1), IIRC
<haakonn>
sounds complicated
<jynxzero>
haakonn, check out a book called "Purely functional data structures"
<jynxzero>
It's not easy but it is just about possible.
<haakonn>
jynxzero: ok, heard about tha tone
<haakonn>
that one*
<jynxzero>
There are O'Caml implementations of all the structures, so if you google for something like ocaml and "catenable list"
<jynxzero>
You'll probably find code.
<haakonn>
will do
mikeX has joined #ocaml
Benooit has joined #ocaml
Gueben has quit [Read error: 110 (Connection timed out)]
ski has quit ["foo"]
avlondono has joined #ocaml
ski has joined #ocaml
ski has quit ["foo"]
ski has joined #ocaml
Tachyon76 has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
mflux_ has joined #ocaml
mflux has quit [Read error: 54 (Connection reset by peer)]
threeve has joined #ocaml
cmeme has quit [Remote closed the connection]
Tachyon76 has quit ["Leaving"]
mikeX has quit ["Leaving"]
cmeme has joined #ocaml
Benooit is now known as Gueben
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
Submarine has quit ["Leaving"]
ski has quit ["foo"]
ski_ has joined #ocaml
ski_ is now known as ski
Gueben has quit [Remote closed the connection]
Submarine has joined #ocaml
ski has quit ["foo"]
Snark has joined #ocaml
monochrom has joined #ocaml
tom_p has quit [Read error: 110 (Connection timed out)]
mrsolo has joined #ocaml
mrsolo has quit [Read error: 104 (Connection reset by peer)]
mrsolo has joined #ocaml
<twobitsprite>
wouldn't "type num = Int of int | Real of float;;" create a type class which contains ints and floats?
<twobitsprite>
er... n/m, I found the example in the tutorial
zigong has joined #ocaml
pnou_ has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
<twobitsprite>
is there a way to have guards in variant definitions?
Schmurtz has quit [Read error: 104 (Connection reset by peer)]
zigong has left #ocaml []
<pango>
twobitsprite: since 3.07 you can create "private types" that can only be constructed in the module where they're defined
<pango>
twobitsprite: that way you can control how new values are created, and enforce invariants