| action | LoganCapaldo wants for teferi to make a comment about parsing xml with regexp |
| LoganCapaldo | wants for teferi to make a comment about parsing xml with regexp s/wants/waits |
| pergesu | LoganCapaldo: awesome, thanks |
| apeiros | well, the script says 280 possible distributions, 35 out of them red is surrounded by blue |
| pstickne_ | hold on, let me crank something out... |
| hypnos22 | pergesu: please don't parse XML with a regex |
| pergesu | hypnos22: I know what I'm doing here, thanks but in case you have any better ideas... |
| apeiros | oh, wait... bg errr,bg |
| hypnos22 | use an xml parsing library. rexml or libxml easier...possibly quicker how long is "long" |
| pergesu | I've got a long XML document that I'm parsing, I just use Hash.from_xml to do it. However I need to maintain the order, and hashes obviously don't do that. So I'm getting all the titles first, and then after I create the hash, I turn it into an array, ordering them by the titles that I originally got |
| apeiros | hah, and then it suddenly was 1 out of 7 http://pastie.caboo.se/52254 exceptionally cheap but hey, we got the power and premature optimization isn't :) (combinations.length is 40320 as expected before the uniq!) |
| pstickne_ | apeiros, http://pastie.caboo.se/52255 # I get ~14% |
| apeiros | 14% == 1/7.0 :-p but interesting approach :D |
| action | apeiros does the lobster dance |
| apeiros | does the lobster dance probability still keeps surprising me. I only asked that stupid question here because I thought 1/7 of a chance is way to high |
| hal_9000 | i suppose you know the birthday paradox |
| apeiros | sure enough :) that's pretty surprising too |
| hal_9000 | until you understand it i always thought of it in terms of throwing darts at a calendar |
| pstickne_ | apeiros, I thought so too when you original said it! :) |
| apeiros | pstickne_, well, I'm happy that my approach was correct. that surprised me a bit too tbh ;-) in case anybody wonders, I just wanted to know how often I'd start not surrounded by enemies in wheel of war (starcraft) ;-) |
| cdcarter | i have a question about the flip flop operator. the truth table for it in the form of a,b, a..b has the line [false, true, true]. this would lead one to believe that false..true is true, but "p 1 if false..true doesn't print |
| pstickne_ | huh? Ruby has ..? (except for range) |
| cdcarter | http://pastie.caboo.se/52256 yea its the flip/flop an old perlism i just found |
| apeiros | yes, and it is a total bitch |