dylan changed the topic of #ocaml to: OCaml 3.09.1 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
bluestorm has joined #ocaml
slipstream-- has joined #ocaml
slipstre1m-- has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
<dark_light> where can i find a list of int operators with the precedences of they? (eg. * have precedence over +...)
slipstream-- has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
<JohGro> dark_light: http://caml.inria.fr/pub/docs/manual-ocaml/manual015.html has a table with precedences. It seems int operations have the same precedences as float operators.
<dark_light> JohGro, thanks!
bluestorm has quit ["Leaving"]
bluestorm has joined #ocaml
slipstream has joined #ocaml
_JusSx_ has joined #ocaml
slipstre1m-- has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
bluestorm has quit [Remote closed the connection]
Skal has joined #ocaml
slipstream has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
<dark_light> what is the diff between 2 * - 1 and 2 * ~- 1? the first multiply the int 2 by -1 and the second negates 1 and then multiply the int 2 by the negative of 1 (that is -1) ?
<dark_light> i am asking it because 2 * - 1 works besides the - is distant from the -1 (it shouldn't be -1?)
<mellum> "-" is the binary minus, or can be applied to literals like 1. "~-" is unary minus.
<mellum> So for 1, it doesn't matter, but for x it would.
<mellum> (at least I think)
<pango> it solves problems in other contexts (f -1 vs. f ~-1)
<pango> without ~- you have to use f (-1)
<mellum> right. I knew it was to resolve some ambiguity :)
<mellum> although I tend to write f (-1) in that case
<pango> ~- is not excessively esthetic
_JusSx_ has joined #ocaml
Muelation has joined #ocaml
mikeX has joined #ocaml
Muelation is now known as Muelation`awaY
* Muelation`awaY away [Auto-Away após 30 minutos] (desde: 18:04:14\mail: null\log: On) (Vibe)
bluestorm has joined #ocaml
* Muelation`awaY away [Auto-Away após 30 minutos] (desde: 18:04:14\mail: null\log: On) (Vibe)
* Muelation`awaY away [Auto-Away após 30 minutos] (desde: 18:04:14\mail: null\log: On) (Vibe)
* mikeX kicks Muelation`awaY
<mikeX> :P
* Muelation`awaY away [Auto-Away após 30 minutos] (desde: 18:04:14\mail: null\log: On) (Vibe)
<sieni> wtf
<mikeX> starting to get really annoying
* Muelation`awaY away [Auto-Away após 30 minutos] (desde: 18:04:14\mail: null\log: On) (Vibe)
<zmdkrbou> grrrrrrrr
Muelation`awaY was kicked from #ocaml by Banana [Banana]
Muelation`awaY has joined #ocaml
<zmdkrbou> apfffffffff auto-rejoin
<mikeX> hahahah
<Banana> ...
Muelation`awaY was kicked from #ocaml by Banana [Banana]
<Banana> still got it.
<Banana> Now i can go back to sleep for another year.
<mikeX> lol
<Banana> Does this guy actually speak here or not ?
<Banana> (aka, is he worth unbanning ?)
<dark_light> why signed ints and "normal" ints (the ints of C p. example) can both store the same number of numbers? signed ints shouldn't have more "space"?
<dark_light> Banana, i don't know, but i think if someone explain him the channel don't likes away messages he would stop
<bluestorm> nope
<bluestorm> dark_light,
<dark_light> bluestorm, so why use signed ints?
<bluestorm> the sign bit take one bit from the total space
<dark_light> Hm..
<bluestorm> hum
<bluestorm> but you have two different numbers with the sign bit
<bluestorm> so totally it's the same
<bluestorm> dark_light, we use signed ints in order to have negative integers
<bluestorm> (did i say something stupid ? It seems the answer is so trivial...)
<dark_light> well, the normal C ints have negative ints, but it seems not be "signed"
<dark_light> there are sign bit on regular C ints?
<bluestorm> yes
<bluestorm> negative int must have a sign bit
<bluestorm> how would you now it is negative ?
<bluestorm> +k
<dark_light> well, i though.. let say a byte.. 0000 0001 is -128, 0000 0010 is -127 .. and 1111 1111 is 127.. you know?
<pango> unsigned 32 bit ints are in range 0 .. 2^32-1, signed in range -2^31 .. 2^31-1
<pango> no matter what, with 32 bits you can store 2^32 different states
<mellum> well, that depends on the architecture
<dark_light> pango, hmm, year, i got it
<dark_light> 0000 0001 differs to 1111 1111 more than a bit, bluestorm
<dark_light> yeah*
<mellum> ah, never mind what I was saying
<bluestorm> two bits :p
<dark_light> no, seven :P
<bluestorm> nope
<bluestorm> 1111 1111 + 10 = 0000 0001
<bluestorm> 127 + 1 = -128
<bluestorm> 127 + 2 = -127
<bluestorm> 127 + 3 = -126 ...
<dark_light> the first to seventh (i don't actually know if this word exists) bit in my -127 is filled with zeroes, and in my 127 is filled with ones
<bluestorm> hum
<dark_light> you got what i am trying to say? explaining on english is just hard for me=(
<bluestorm> i see what you mean
<bluestorm> i think
<dark_light> so i think the int and the signed int of C is quite different
<dark_light> maybe the signed int helps on calculating absolute values
<Banana> pango: i was going to say that.
<dark_light> hhahahaha thanks
<dark_light> -0 and +0 are actually different numbers, aren't? there are more negative numbers than positives.. so the -0 wasn't lost and considered equal to +0
<pango> that's answered in the wiki page
<Banana> dark_light: there is only one representation for 0. ( 0000 0000).
<dark_light> wow, it's more complicated i ever imagined
<Banana> dark_light: the whole thing is in two's complement encoding for negative numbers.
<Banana> dark_light: yes but it makes things easier for computers :)
jo_l_apache has joined #ocaml
<dark_light> easier? if you are saying..
<Banana> dark_light: i meant more uniform.
<Banana> consider the enconding where 0 xxx xxxx are positive numbers and 1 xxx xxxx are negative (that's what you were thinking right ?).
<Banana> and try writing the algorithm for the addition.
<dark_light> Banana, that was i were thinking
<dark_light> and, hmmmmmmmmmmmmmm..
<dark_light> yeah
<dark_light> ;
<dark_light> :)
<Banana> first this is bad because you have +0 and -0, so you waste 1 value.
<Banana> and there was a time, (in a galaxy far far away) when that kind of thing was a big deal.
<dark_light> hmmmmmmm
<dark_light> Banana, why signed ints are better than normal ints?
<dark_light> or. why ocaml uses them?
<Banana> i'm not sure what you mean by normal ints...
<dark_light> well..
<Banana> unsigned ?
<dark_light> no
<dark_light> "well, i though.. let say a byte.. 0000 0001 is -128, 0000 0010 is -127 .. and 1111 1111 is 127.. you know?"
<Banana> ha.
<Banana> you cannot do that.
<Banana> because it doesn' scale well.
<dark_light> Banana, int's aren't counted that way?
<dark_light> hmmmmmmm
<dark_light> so this model is a.. char? :)
<dark_light> chars is counted in the order, but ints aren't?
<Banana> ?
<pango> see "how it works" in the wiki page
<dark_light> why it works?
<pango> why it works, yes
<dark_light> the mathmatics there is so complex. i am a bit.. sleeply now
<Banana> dark_light: yes read carefully the wiki page, but with what you said you would have 0000 0000 = 0, 0000 0001 = -128, 0000 0010 = -127 ... ?
<Banana> if i understand correctly ?
<dark_light> Banana, yes
<Banana> you cannot do that.
<dark_light> the char type of C is counted "in the order" (i meant.. the first character is 0000 0000, the second is 0000 0001..)
<Banana> you are on a byte, so you say ok, 0000 0001 is -128.
<dark_light> an int on a byte aren't counted one after another?
<Banana> but now you want to encode 16 bytes ?
<pango> it's not unusual that mathematics gives answers to problems involving numbers
<Banana> you have 0000 0000 0000 00010 is -128 ?
<Banana> or is it -65536 ?
<dark_light> Hmmmmm.. yeah
<dark_light> 0000 0000 0000 00010 would move to -65536
<pango> (or is it ? it's also a source of most of those problems too ;) )
<dark_light> pango, i don't understand what you meant
jo_l_apache has quit ["leaving"]
<Banana> dark_light: ok so when you add -128 (byte) to a 16 bits word you have to do a conversion.
<dark_light> Hmmmmmmm...
<pango> dark_light: if you're interested in numbers, there's no work around mathematics
<Banana> dark_light: to start with, you should REALY forget about types (i cannot belive i'm actually saying that here ;)).
<mellum> pango: of course not. Who'd ever be able to count to 10 without understanding the Peano axioms?
<Banana> dark_light: they are just conventions.
<Banana> forget about chars, ints, and such.
<dark_light> pango, you are right, but i was interested on concepts because i am.. how could i say? sleeply
<dark_light> my eyes is closing right now
<dark_light> bookmarked:)
Snark has quit ["Leaving"]
<pango> after a nap you can have a look at "rings" in algebra books too :)
<twobitsprite> is there any overhead for using "fun" over "function" when the function is only taking one argument anyways?
<pango> twobitsprite: have you looked at generated asm ?
<twobitsprite> pango: not yet... I'm not the keenest on asm, so I was hoping someone could tell me...
<mellum> twobitsprite: no
<Banana> no.
<Demitar> If you're wondering about the overhead of those two syntaxes you're probably optimizing way too early anyway. :)
Anarchos has joined #ocaml
<twobitsprite> Demitar: I was just curious...
<Demitar> Good. :)
* Demitar has mostly puts "optimizations" off to code cleanup and the occacional memoization these days. :)
<twobitsprite> I'm a big fan of doing TheSimplestThingThatCouldPossiblyWork and if it's way too slow, I'll tweek a few things until its FastEnough(tm)
<Banana> hum...
<Demitar> Yes, simple code is usually fast code. :)
<twobitsprite> but I figured there was no harm in typing out "ction" if it would make a significant difference...
<Demitar> I know you didn't mean to, but you confused "simple code" and "compact code" in that sentence. :)
<Anarchos> a naive recursive fibonacci is far form the fastest ...
<Demitar> Anarchos: And how often do you write your own fibonacci in a normal application? :)
<dark_light> twobitsprite, me too, but my code instead is quite complex.=(
<mellum> function calls are optimized quite well in Ocaml (unlike almost everything else).
<twobitsprite> dark_light: always keep in mind the differences between complexity and complication... complex is good, complicated is bad
<twobitsprite> mellum: are the authors slack on optimizations?
<Anarchos> Demitar : 1/ U(1978) ??
<Banana> twobitsprite: there is a difference however, you can put pattern matching branches after function, you cannot after fun.
<Demitar> What I prioritize most is actually well named variable, maintenance is usually the tricky part in the end.
<mellum> twobitsprite: It's not the main focus.
<twobitsprite> Banana: I realize this...
<dark_light> i simply doesn't program on levels. the simple things on a part, the advanced features on another. i mix everything
<pango> twobitsprite: they're fans of doing TheSimplestThingThatCouldPossiblyWork
<Anarchos> pango the logical team is not part of this sect though ;)
<twobitsprite> pango: I tend to do the SimplestThing because I expect my compiler to take care of the complications, so that's fine with me...
<bluestorm> hum
<Demitar> pango: I might not be such a rabid follower actually, I'm more of a TheQuickestThingICanComeUpWithAndI'llOptimize"Later". :)
<bluestorm> imho you like TheAwfulJavaNotation too much
<twobitsprite> bluestorm: well... I intended it as WikiNotation...
<mellum> CamlCase ;-)
<bluestorm> Ocaml guidelines are very useful, and they use a good notation :p
<bluestorm> hum
<bluestorm> i meant a_good_notation
<Banana> (a (good notation))
<bluestorm> erk
<Banana> ha ha ha.
<bluestorm> you odd scheme user :-°
<Banana> ?
<Banana> i don't think so, that was ocaml code.
<bluestorm> ah
<twobitsprite> bluestorm: hence I was making an intentional reference to a specific WikiWiki page
<Banana> (i know i don't need the outer ()
<Banana> ).
<bluestorm> i know you know ;)
<Demitar> twobitsprite: Reading that makes it feel like following it is a lot of extra work. :)
<Banana> anyone familiar with pxp event based parser ?
<twobitsprite> Demitar: yeah... the WikiFolk tend to be a bit like an "XtremeProgramming" cult... taking things a bit too far...
<twobitsprite> Banana: event based parsing sounds like something I would hate...
<Banana> it's for xml.
* Demitar never got around to really using pxp, xml-light does everything I've ever needed (not reading much xml in the end :).
<Banana> ok.
<Banana> not a big deal but at some point it returns (tagnam,attlists,otherthings) and attlists seems to be in reverse order of the document order.
<Banana> i know order is not to be considered for attributes in xml in general.
<Demitar> You might want to report it though, sounds like a quirk.
<Banana> know.
<Banana> i think i understand why.
<Banana> you start with []
<Banana> and while parsing you cons attributes as you find them.
<Banana> fast.
<Banana> and as i said, order should'nt be relevent for attributes.
<Demitar> Yes, why can easily be imagined, but it's still nice if people using the library are aware.
<Banana> i wanted to read the code to be sure...
<Banana> but damn' it's obfuscated :)
<Banana> (aka, i'm not used to objects and i'm fine with that).
jo_l_apache has joined #ocaml
jo_l_apache has quit ["leaving"]
ellisonch has joined #ocaml
Snark has joined #ocaml
Submarine has joined #ocaml
bluestorm has quit [Remote closed the connection]
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
jo_l_apache has joined #ocaml
Skal has quit [Remote closed the connection]
Snark has quit ["Leaving"]
jo_l_apache has quit ["leaving"]
JKnecht has quit ["Lost terminal"]
mrsolo_ has quit [Connection reset by peer]
mrsolo_ has joined #ocaml
Schmurtz has joined #ocaml
knobo has quit [Read error: 101 (Network is unreachable)]
mikeX has quit [Read error: 110 (Connection timed out)]
knobo has joined #ocaml
Schmurtz has quit ["Dodo !"]
Schmurtz has joined #ocaml
mikeX has joined #ocaml
smimou has quit ["bli"]
knobo has quit [Read error: 110 (Connection timed out)]
_JusSx_ has quit ["leaving"]
knobo has joined #ocaml
Submarine has quit ["Leaving"]
JKnecht has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
Skal has joined #ocaml
Revision17 has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
mikeX has quit [Remote closed the connection]
twobitsprite has quit [Remote closed the connection]
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
foof has joined #ocaml
Revision17 has quit ["rebooting; back in a few"]
Smerdyakov has quit ["Leaving"]
Revision17 has joined #ocaml
MisterC has joined #ocaml
Submarine has joined #ocaml
Skal has quit [Read error: 110 (Connection timed out)]
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo_ has joined #ocaml