<Riastradh>
5 / 9 will produce a floating point result.
<Riastradh>
* can only take ints.
<lsr>
This expression has type int but is here used with type unit
<lsr>
sorry, forgot to paste that last bit
<lsr>
why does it say "used with type unit" instead of something to do with float?
<Riastradh>
Oh, hmm.
<lsr>
(your answer otherwise makes sense)
<Riastradh>
What's the context of the code?
<lsr>
it's meant to convert farenheit to celcius
<Riastradh>
That I deduced already.
<lsr>
:)
<Smerdyakov>
I see you are at the forefront of computer science research, lsr.
<Riastradh>
Paste the whole function in here -- I assume it's not longer than about three lines or so.
<lsr>
let calculate temp s =
<lsr>
if s = Farenheit then
<lsr>
(temp - 32) * (5 / 9)
<lsr>
else if s = Celcius then
<lsr>
temp * 9 / 5 + 32;;
* lsr
feels like a First Year all over again
<Riastradh>
You need an 'else' for that other 'if'.
<Riastradh>
Although I would use the 'match' syntax, not 'if' expressions.
<lsr>
oh, nice
<lsr>
Warning: this pattern-matching is not exhaustive.
<lsr>
Here is an example of a value that is not matched:
<lsr>
Kelvin
<lsr>
..match s with
<lsr>
that's a cool warning
Smerdyakov has quit ["reboot"]
Smerdyakov has joined #ocaml
polin8_ has quit ["Now _that's_ a good cup of coffee."]
Kinners has joined #ocaml
pattern_ has quit [sterling.freenode.net irc.freenode.net]
pattern_ has joined #ocaml
polin8 has quit [Read error: 104 (Connection reset by peer)]
lament has quit ["heh"]
polin8 has joined #ocaml
mattam has joined #ocaml
smkl has joined #ocaml
xtrm has joined #ocaml
Zadeh has quit [Read error: 104 (Connection reset by peer)]
Kinners has left #ocaml []
gene9 has joined #ocaml
^AndyA^ has joined #ocaml
gene9 has quit [Read error: 104 (Connection reset by peer)]
* seth_
is away: Off to the glue factory
gene9 has joined #ocaml
<Vincenz>
lsr: Wouldn't it be better to use a type
gene9 has quit []
<Vincenz>
Smerdyakov:
<Vincenz>
Smerdyakov: Lol
<Vincenz>
type temperature = Celsius float | Fahrenheit float | Kelvin float;;
<mellum>
Vincenz: looks like a bad idea to me
<Vincenz>
how so?
<Vincenz>
convert someTemperature (Celsius 1)
<mellum>
Because a temperature is independent of the unit it is measured in.
<Vincenz>
no it's not
<Vincenz>
0 celsius = 32 fahrenheit
<mellum>
So we had no temparatures before these units were invented?
<Vincenz>
no, but did we have trees before the ENGLISH SWORD "tree" was intevented?
<Vincenz>
of course we did, that doesn't mean we can't have a dictionary to look up the french version of the word tree
<Vincenz>
ugh, I hate lag on an ssh system, makes me type bad
<mellum>
If 0 celsius is really the same as 32 fahrenheit, there should not be two different was to express that temperature
<mellum>
ways
<Vincenz>
mellum: how would you do it then?
<mellum>
Or calculations with it get really annoying.
<Vincenz>
besides, this was inresponse to lsr's problem before
<Vincenz>
besides
<Vincenz>
you SHOULD have multiple ways
<Vincenz>
otherwise you get stuff like spacestations crashing because you don't remember to convert from miles to kilometers
<mellum>
Make an abstract datatype temperature. Choose any way to represent it, like kelvin. Have converters from and to the three units.
<Vincenz>
abstract data types means modules. Modules were not the sort of thing lsr seemed to be using. he just had a simple example
<mellum>
well, modules can *enforce* the abstractness. But you don't need them.
<Vincenz>
How do you make colors with ircII?
<mellum>
I have no clue.
<Vincenz>
so how come *enforce* is white
<Vincenz>
oh
<Vincenz>
odd
<Vincenz>
*test*
<mellum>
because I put '*' around it?
<Vincenz>
ah it highlights stuff between **
* Vincenz
nods at mellum
<Vincenz>
but that's not the usual way of doing it, in mirc you can choose the colors
<Vincenz>
_test_
<Vincenz>
neat :)
<Vincenz>
_ test _
__DL__ has joined #ocaml
<Vincenz>
Hmm, how do you tell where the end of a matcher is?
<Vincenz>
?
<Vincenz>
like if you have one matcher inside the case of a second matcher. How do you tell where the internal matcher stops and the external one continues?
<asqui>
wow, what the hell is a 'matcher'?
<Vincenz>
match w with...
foxster has joined #ocaml
<Smerdyakov>
Vincenz, are you just asking how the compiler implicitly inserts parentheses with nested matches?
gene9 has joined #ocaml
<Vincenz>
no, I'm asking how to make nested matches so that the compiler knows where the internal one stops and the external one restarts. A matcher doesn't have an end
<Vincenz>
match a with
<Vincenz>
Plop -> match b with
<Vincenz>
Bleep -> 1
<Vincenz>
| Bloop -> 2
<Vincenz>
so how do I go back to the second case of the match a
<Smerdyakov>
Yes, you're asking how the compiler guesses where to put parentheses.
<Vincenz>
yup :)
<Smerdyakov>
That _should_ suggest the answer.....
<Vincenz>
heh, parentheses
<Vincenz>
alright
foxster has quit [Read error: 110 (Connection timed out)]
gene9 has quit [Read error: 104 (Connection reset by peer)]
smklsmkl has joined #ocaml
smkl has quit [sterling.freenode.net irc.freenode.net]
mattam has quit [sterling.freenode.net irc.freenode.net]
asqui has quit [sterling.freenode.net irc.freenode.net]
wax has quit [sterling.freenode.net irc.freenode.net]
Vincenz has quit [sterling.freenode.net irc.freenode.net]
seth_ has quit [sterling.freenode.net irc.freenode.net]
lam has quit [sterling.freenode.net irc.freenode.net]
mattam has joined #ocaml
lam has joined #ocaml
asqui has joined #ocaml
wax has joined #ocaml
smklsmkl has quit [Read error: 104 (Connection reset by peer)]
smklsmkl has joined #ocaml
Vincenz has joined #ocaml
smklsmkl has quit [Read error: 104 (Connection reset by peer)]
smklsmkl has joined #ocaml
seth_ has joined #ocaml
^AndyA^ has quit ["Client Exiting"]
lus|wazze has joined #ocaml
Vincenz is now known as vincenz_
<vincenz_>
*silence*
<vincenz_>
{-_^}
<lus|wazze>
8|
foxster has joined #ocaml
<lus|wazze>
well what would you have us say? 8)
<lus|wazze>
:/
<lus|wazze>
now hes suddenly fallen silent himself X)
mattam_ has joined #ocaml
pattern_ has quit [sterling.freenode.net irc.freenode.net]
pattern_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
foxster has quit [Read error: 104 (Connection reset by peer)]
foxster has joined #ocaml
foxster has quit [Read error: 104 (Connection reset by peer)]
lus|wazze has quit [sterling.freenode.net irc.freenode.net]
iusris_ has quit [sterling.freenode.net irc.freenode.net]
Riastradh has quit [sterling.freenode.net irc.freenode.net]
xtrm has quit [sterling.freenode.net irc.freenode.net]
docelic|away has quit [sterling.freenode.net irc.freenode.net]
gl has quit [sterling.freenode.net irc.freenode.net]
lus|wazze has joined #ocaml
xtrm has joined #ocaml
iusris_ has joined #ocaml
gl has joined #ocaml
docelic|away has joined #ocaml
Riastradh has joined #ocaml
asqui has quit [Excess Flood]
asqui has joined #ocaml
gl has quit [sterling.freenode.net irc.freenode.net]
docelic|away has quit [sterling.freenode.net irc.freenode.net]
xtrm has quit [sterling.freenode.net irc.freenode.net]
iusris_ has quit [sterling.freenode.net irc.freenode.net]
lus|wazze has quit [sterling.freenode.net irc.freenode.net]
Riastradh has quit [sterling.freenode.net irc.freenode.net]
lus|wazze has joined #ocaml
xtrm has joined #ocaml
iusris_ has joined #ocaml
Riastradh has joined #ocaml
docelic|away has joined #ocaml
gl has joined #ocaml
asqui has quit [Excess Flood]
asqui has joined #ocaml
TachYon has joined #ocaml
TachYon has quit [sterling.freenode.net irc.freenode.net]
gl has quit [sterling.freenode.net irc.freenode.net]
docelic|away has quit [sterling.freenode.net irc.freenode.net]
xtrm has quit [sterling.freenode.net irc.freenode.net]
xtrm has joined #ocaml
docelic|away has joined #ocaml
TachYon has joined #ocaml
gl has joined #ocaml
lus|wazze has quit ["The ultimate downfall of society is the greatest advancement in communications technology being used to find pictures of peop]
karryall has joined #ocaml
TachYon has quit ["Client Exiting"]
foxster has joined #ocaml
grem has joined #ocaml
<grem>
How is 'ocaml' actually pernonced?
<grem>
is it like o-camel
<Smerdyakov>
That's how I say it!
<Riastradh>
That's how I say it too.
<Smerdyakov>
That's how Jesus says it.
<Riastradh>
Indeed.
<asqui>
How ele would you say it?
<asqui>
oh-ka-mool?
<asqui>
Even that's really the same thing isn't it.
<Riastradh>
oh-see-ay-em-el
<Riastradh>
oh-kay-em-el
grem has quit ["Client Exiting"]
foxster has quit [Read error: 110 (Connection timed out)]