mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.0 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
magius_pendragon has quit [Read error: 104 (Connection reset by peer)]
pants1 has joined #ocaml
azoic has quit [Remote closed the connection]
rwmjones has quit [Read error: 104 (Connection reset by peer)]
rwmjones has joined #ocaml
Jessehk has joined #ocaml
Jessehk has left #ocaml []
azoic has joined #ocaml
ednarofi has quit [Read error: 110 (Connection timed out)]
cmeme has quit [Client Quit]
cmeme has joined #ocaml
smimou has quit ["bli"]
azoic has quit ["Beavis & Butthead use Irssi. Huh-huh huh-huh huh-huh he said "Irssi"."]
buluca has quit [Read error: 113 (No route to host)]
yminsky has joined #ocaml
jlouis has joined #ocaml
nuncanada has quit ["Leaving"]
mordaunt has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
yminsky has quit []
[azoic] has joined #ocaml
Jessehk has joined #ocaml
<Jessehk> Hi all. I'm bored so I'm playing with Functors and I was wondering if I did things correctly. Would anyone care to look? http://paste.lisp.org/display/49232
Jessehk has quit ["Leaving"]
david_koontz has quit []
pants1 has quit [Read error: 110 (Connection timed out)]
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
kelaouchi has quit ["leaving"]
jonafan has joined #ocaml
clog has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
buluca has joined #ocaml
joshcryer has quit [Read error: 110 (Connection timed out)]
ygrek has quit [Remote closed the connection]
seafoodX has joined #ocaml
bruci has joined #ocaml
joshcryer has joined #ocaml
smimou has quit ["bli"]
seafoodX has quit []
zvrba has quit [Read error: 110 (Connection timed out)]
buluca has quit [Read error: 113 (No route to host)]
bruci has quit ["Verlassend"]
Nutssh has quit ["Client exiting"]
zvrba has joined #ocaml
sioraiocht has quit []
seafoodX has joined #ocaml
seafoodX has quit []
seafoodX has joined #ocaml
buluca has joined #ocaml
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
Tetsuo has joined #ocaml
mordaunt has quit [Read error: 104 (Connection reset by peer)]
seafoodX has quit []
buluca has quit [Read error: 110 (Connection timed out)]
leo037 has joined #ocaml
Torment has quit [Read error: 104 (Connection reset by peer)]
crathman has joined #ocaml
Jedai has joined #ocaml
[azoic] has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
[azoic1 has joined #ocaml
buluca has joined #ocaml
buluca has quit [Remote closed the connection]
buluca has joined #ocaml
[azoic] has quit [Read error: 110 (Connection timed out)]
bluestorm_ has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
kelaouchi has quit [Client Quit]
[azoic1 has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
buluca has joined #ocaml
kelaouchi has joined #ocaml
lde``` is now known as lde
crathman has quit ["ChatZilla 0.9.78.1 [Firefox 2.0.0.7/2007091417]"]
crathman has joined #ocaml
leo037 has quit ["Leaving"]
Torment has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
Jedai has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
Mr_Awesome has joined #ocaml
hagman has joined #ocaml
hagman has left #ocaml []
joshcryer has quit [Nick collision from services.]
joshcryer has joined #ocaml
buluca has joined #ocaml
buluca has quit [Remote closed the connection]
buluca has joined #ocaml
screwt840 has joined #ocaml
leo037 has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
bluestorm_ has quit [Remote closed the connection]
Abo-Marwan14 has joined #ocaml
ita has joined #ocaml
ygrek has quit [Remote closed the connection]
Tetsuo has quit ["Leaving"]
claudiotainen has joined #ocaml
<claudiotainen> hello I'd like to define a new type in ocaml, the type of integers >= 0 && <= 9
<claudiotainen> how can I do that? [I'm a complete newbie and ocaml syntax is something weird for me ... ]
<pango_> there's no such type
leo037 has quit ["Leaving"]
<claudiotainen> yes i mean I want to create a new type like that
<claudiotainen> maybe using type = ...
<zmdkrbou> well you can define it though it won't really be integers : "type t = One | Two | Three | ... "
<pango_> there would be interesting problems with it, like all standard integer operations not being internal
<claudiotainen> something like enum in C
<claudiotainen> oh yes that's what I meant
<pango_> so, if you add two such values, or one such value with an integer, what's the type of the result...
<claudiotainen> so I can't use usual symbols for my new type ?
rfischer has joined #ocaml
<claudiotainen> well I don't mid a lot because what I have to do is a [very] small interpreter for the [simplified] language of integer expressions
<pango_> there's no such type as "integers >= 0 and <= 9", but you could approximate it
<pango_> sum types are one solution, as said zmdkrbou
<rfischer> This is actually something I was just thinking about today. :-D
<pango_> another could be a private type defined in a module
<rfischer> It'd be nice in a lot of cases to specify an allowable range of an int as a type constraint.
<claudiotainen> .... uhm ok think that's far too complicated for someone [like me ;)] who has always and only used imperative languages
<ita> the question is ambiguous
seafoodX has joined #ocaml
<claudiotainen> what do u think is ambiguous ita ?
<ita> claudiotainen: what is your interpreter supposed to do ?
<claudiotainen> it would take an expression as the input and produce an Int value as the output
<ita> claudiotainen: ocaml has imperative, object-oriented and functional features, depending in what you want to do you can decide for one kind of code style
<claudiotainen> yeah, but I'm using it for a course which deals with functional programming, so I've got to use only its functional features ... no way out
<claudiotainen> anyhow, as regards my expression ...
<claudiotainen> the terminals should be only integers from 0 to 9
<ita> use the natural number construction then (1 is S 0, 2 is S S 0, etc)
<claudiotainen> ita could you please be abit more explicit ?
<ita> claudiotainen: do you remember how the set of natural numbers is built ? :-)
kelaouch1 has joined #ocaml
<claudiotainen> u mean in ocaml ?
<claudiotainen> or in maths ?
<ita> in maths
<claudiotainen> ah of course I do :D
<ita> claudiotainen: okay, you can use that then :-)
<claudiotainen> ita: what I don't understand is "1 is S 0"
<ita> the Successor of 0 is one
<ita> a function, and the symbol Zero
<ita> btw, look at the "match" construct
<pango_> what prevents you from constructing S S S S S S S S S S 0 ?
<ita> have fun
<claudiotainen> uhm ok so recursion
<claudiotainen> thank you ita, I'll think about it
<ita> pango_: S S S S S S S S S S 0 matches as 0 and done :-)
<claudiotainen> [ I just hopw you're not my univ teacher ;-) ]
<ita> claudiotainen: ciao claudio!
<claudiotainen> non sei un docente univeristario , vero ?
<ita> claudiotainen: no :-)
<claudiotainen> ok that's fine then :D
<ita> (too bad i do not speak italian, it could have been fun)
<claudiotainen> ahhah :D
<claudiotainen> so i suppose that ita doesn't stand for italy
<ita> claudiotainen: no
<pango_> (using private types idea: http://pastebin.be/5891)
<claudiotainen> thanx for your help pango , but I'm supposed not to use o-o features :(
<pango_> there's none here
<claudiotainen> well private and assert are typical of o-o
<claudiotainen> I mean I really ought to use only ... functions
<pango_> they're not as far as I'm concerned
kelaouchi has quit [Connection timed out]
<pango_> asserts are definitely not linked to any specific paradigm, and private here has not the meaning usually associated with it in o-o context
<pango_> it just mean that you cannot use the constructors of the sum type to build new values outside of the current module
<pango_> but you can still use them for pattern matching, for example
<rfischer> Got a question for the people in the room.
<claudiotainen> mmm ok I'd better have said " I don't know ocaml oo features " ;)
<pango_> claudiotainen: neither do I
<rfischer> Using the Unix.read method, how do you detect end-of-file?
<pango_> rfischer: if it's faithful to read(2), it should returns 0
claudiotainen has quit ["leafChat IRC client: http://www.leafdigital.com/Software/leafChat/"]
<rfischer> You mean, it will return a 0-byte?
<rfischer> I need to distinguish between a non-blocking "There's no data available right now", and an EOF.
psnively has joined #ocaml
<rfischer> So the fact that it returns 0 bytes doesn't necessarily mean that there won't be data to return sometime.
psnively has quit [Client Quit]
<pango_> return 0
psnively has joined #ocaml
<rfischer> Nifty.
<rfischer> Thanks.
<pango_> in non-blocking context, when there's "no data available right now" it should raise Unix.EWOULDBLOCK (iirc)
<pango_> or maybe EAGAIN (reading man page again)
<rfischer> Yeah, I'm seeing that now.
<rfischer> That's obnoxious.
<rfischer> Thanks for the help.
<pango_> that's Unix for you ;)
<pango_> np
ita is now known as ita|zzz
ita|zzz has quit ["Hasta luego!"]
<rfischer> Okay, I'm off.
rfischer has left #ocaml []
jonafan has quit ["Leaving"]
jonathanv has joined #ocaml
sioraiocht has joined #ocaml
Mr_Awesome has joined #ocaml
crathman has quit ["ChatZilla 0.9.78.1 [Firefox 2.0.0.7/2007091417]"]
seafoodX has quit []
azoic has joined #ocaml
azoic has quit ["leaving"]
azoic has joined #ocaml