2013-03-23T00:23:13 *** janzert has quit IRC (Read error: Connection reset by peer) 2013-03-23T00:23:38 *** yoden1 has quit IRC (Read error: Connection reset by peer) 2013-03-23T00:23:38 *** janzert has joined #aichallenge 2013-03-23T00:24:39 *** yoden has joined #aichallenge 2013-03-23T03:14:33 *** Accoun has quit IRC () 2013-03-23T03:14:45 *** thestinger has quit IRC (Quit: WeeChat 0.4.0) 2013-03-23T03:20:23 *** Accoun has joined #aichallenge 2013-03-23T03:45:39 *** Cyndre_ has joined #aichallenge 2013-03-23T03:46:07 *** Cyndre has quit IRC (Read error: Connection reset by peer) 2013-03-23T04:09:40 *** epicmonkey has joined #aichallenge 2013-03-23T04:56:53 *** mattswe has quit IRC (Ping timeout: 248 seconds) 2013-03-23T06:41:54 *** antimatroidl has joined #aichallenge 2013-03-23T06:48:22 *** kilae has joined #aichallenge 2013-03-23T06:50:17 *** iglo has joined #aichallenge 2013-03-23T06:55:21 *** mattswe has joined #aichallenge 2013-03-23T06:58:57 *** iglo has quit IRC (Quit: .) 2013-03-23T07:54:48 *** epicmonkey has quit IRC (Ping timeout: 256 seconds) 2013-03-23T08:53:42 *** ronchaine has quit IRC (Remote host closed the connection) 2013-03-23T09:03:37 *** NoxiaZ^ has joined #aichallenge 2013-03-23T10:02:12 *** sigh has quit IRC (Remote host closed the connection) 2013-03-23T10:16:12 *** epicmonkey has joined #aichallenge 2013-03-23T10:26:54 *** sigh has joined #aichallenge 2013-03-23T10:29:48 *** amstan_ has quit IRC (Ping timeout: 258 seconds) 2013-03-23T10:31:27 *** sigh has quit IRC (Ping timeout: 260 seconds) 2013-03-23T10:38:47 *** sevikkk has quit IRC (Ping timeout: 245 seconds) 2013-03-23T10:52:39 *** sevikkk has joined #aichallenge 2013-03-23T11:05:17 *** sevikkk has quit IRC (Ping timeout: 246 seconds) 2013-03-23T11:08:47 *** NoxiaZ^ has quit IRC (Ping timeout: 245 seconds) 2013-03-23T11:26:12 *** sevikkk has joined #aichallenge 2013-03-23T11:29:01 *** sevikkk1 has joined #aichallenge 2013-03-23T11:31:07 *** sevikkk has quit IRC (Ping timeout: 264 seconds) 2013-03-23T11:57:32 *** capa has joined #aichallenge 2013-03-23T11:59:38 *** sevikkk has joined #aichallenge 2013-03-23T12:02:53 *** sevikkk1 has quit IRC (Ping timeout: 255 seconds) 2013-03-23T12:06:48 *** smiley1983 has quit IRC (Ping timeout: 252 seconds) 2013-03-23T12:22:23 *** NoxiaZ^ has joined #aichallenge 2013-03-23T12:39:12 *** capa has quit IRC (Ping timeout: 245 seconds) 2013-03-23T12:46:54 *** amstan_ has joined #aichallenge 2013-03-23T12:46:54 *** ChanServ sets mode: +o amstan_ 2013-03-23T12:46:55 *** mcstar has joined #aichallenge 2013-03-23T14:22:30 *** thestinger has joined #aichallenge 2013-03-23T14:49:36 *** thestinger has quit IRC (Ping timeout: 252 seconds) 2013-03-23T14:52:47 *** coeus has joined #aichallenge 2013-03-23T15:00:22 *** sevikkk has quit IRC (Read error: Operation timed out) 2013-03-23T15:04:15 *** thestinger has joined #aichallenge 2013-03-23T15:12:17 *** capa has joined #aichallenge 2013-03-23T15:17:42 thestinger: find my latest blog http://liquid-phynix.github.com/ 2013-03-23T15:17:49 i mean post 2013-03-23T15:17:53 lates post on the blog 2013-03-23T15:18:04 ive got to get used to the terminology 2013-03-23T15:18:09 *** sevikkk has joined #aichallenge 2013-03-23T15:36:03 * thestinger reads 2013-03-23T15:36:14 it* 2013-03-23T15:42:00 mcstar: oh so that's the nesting thing 2013-03-23T15:42:09 ah yeah 2013-03-23T15:42:23 mcstar: I think a variadic template would work 2013-03-23T15:44:49 maybe, i dont know how 2013-03-23T15:47:43 this jekyll drives me crazy 2013-03-23T15:47:48 piece of crap shit 2013-03-23T15:49:53 shit 2013-03-23T15:49:55 i forgot 2013-03-23T15:50:08 ruby calls python for python2.7 2013-03-23T15:50:11 *** capa has quit IRC (Ping timeout: 260 seconds) 2013-03-23T15:50:17 and wont work with arch's python python3 2013-03-23T16:02:24 thestinger: i dont want you to write it, just tell me, how would that be possible? i could do it in lisp, but certainly no in c++ 2013-03-23T16:02:31 not* 2013-03-23T16:12:39 mcstar: you can do it like std::array is done 2013-03-23T16:12:43 it's a recursive variadic template 2013-03-23T16:29:46 i just dont have the faintest idea of the metaprogramming model of c++ 2013-03-23T16:33:10 *** thestinger has quit IRC (Quit: WeeChat 0.4.0) 2013-03-23T16:33:50 *** thestinger has joined #aichallenge 2013-03-23T16:46:41 thestinger: shit, it worked 2013-03-23T16:46:54 well, not the whole thing, but i wrote a recursive template 2013-03-23T16:47:40 *** thestinger has quit IRC (Ping timeout: 252 seconds) 2013-03-23T16:48:01 now i just need to pass parameters, the outer loop variables to the inner loops 2013-03-23T16:55:34 *** thestinger has joined #aichallenge 2013-03-23T17:02:33 thestinger: is it possible to have a default case when i have two template parameters? 2013-03-23T17:03:27 template struct Foo{}; template struct Foo<1> {} 2013-03-23T17:03:37 that would do somehting similar 2013-03-23T17:05:02 mcstar: you can have lists 2013-03-23T17:05:17 can i haz cheezburger? 2013-03-23T17:05:46 *** epicmonkey has quit IRC (Ping timeout: 258 seconds) 2013-03-23T17:10:09 why the hell would anyone want to write template shit++ 2013-03-23T17:16:22 mcstar: templates really aren't that bad 2013-03-23T17:16:47 mcstar: it's a purely functional language that has a list type and has C++ integers and types as the values 2013-03-23T17:16:52 yeah, in proper languages, i guess they arent 2013-03-23T17:17:00 'proper'? 2013-03-23T17:17:01 yeah yeah i read that too 2013-03-23T17:17:15 thestinger: understand as 'lisp' 2013-03-23T17:17:16 the C++ template language even has pattern matching 2013-03-23T17:17:22 mcstar: lisp doesn't have templates, it has macros 2013-03-23T17:17:25 ;p 2013-03-23T17:17:27 yeah 2013-03-23T17:17:29 rust has macros too, not templates 2013-03-23T17:17:36 templates are macros 2013-03-23T17:17:39 no they aren't 2013-03-23T17:17:45 why not? 2013-03-23T17:18:09 because they have full knowledge of the static types, they don't spit out C++ 2013-03-23T17:18:17 they get compiled *with* the rest of the code, by design 2013-03-23T17:18:36 lisp macros generate lisp 2013-03-23T17:18:43 horrific C textual macros generate C 2013-03-23T17:18:49 C++ templates don't map to C++ 2013-03-23T17:18:49 i dont see how c++ templates dont generate c++ code 2013-03-23T17:18:59 thestinger: that doesnt matter 2013-03-23T17:19:11 if it generates c++ source or just compiled code 2013-03-23T17:19:27 it does, a macro generates source in language ;p 2013-03-23T17:19:39 the final result is the same 2013-03-23T17:19:41 you can run a pretty printer over a lisp program and see what the macros turn into 2013-03-23T17:19:55 you can run macroexpand 2013-03-23T17:20:03 and control the level of expansion 2013-03-23T17:20:07 but thats a plus! 2013-03-23T17:20:13 mcstar: templates know about types, macros don't 2013-03-23T17:20:15 you can actually inspect what code you generate 2013-03-23T17:20:21 thestinger: ofc they do 2013-03-23T17:20:28 macros know about types as AST nodes 2013-03-23T17:20:31 you can use every function in macros as in normal code 2013-03-23T17:20:46 ah no 2013-03-23T17:20:52 mcstar: talking about macros in a statically typed language tho 2013-03-23T17:20:55 because lisp is dynamicall tupes 2013-03-23T17:20:57 typed 2013-03-23T17:21:02 mcstar: not all lisps are, racket! 2013-03-23T17:21:13 who the f cares about typed racket? 2013-03-23T17:21:15 XD 2013-03-23T17:21:26 thats is some experimental derivative 2013-03-23T17:21:44 most lisps are not statically typed 2013-03-23T17:21:51 also, raket is close to scheme 2013-03-23T17:21:54 thats not lisp 2013-03-23T17:40:28 *** thestinger has quit IRC (Ping timeout: 252 seconds) 2013-03-23T17:47:50 *** thestinger has joined #aichallenge 2013-03-23T17:49:02 thestinger: i killed it nloop.cpp:10:9: error: template instantiation depth exceeds maximum of 900 XD 2013-03-23T17:49:29 ;p 2013-03-23T17:49:37 mcstar: are you using type lists? 2013-03-23T17:49:45 no, just variadic 2013-03-23T17:49:55 if i cant make it, ill look at those 2013-03-23T17:49:57 mcstar: did you add a base case? :P 2013-03-23T17:50:03 i thought i did 2013-03-23T17:50:21 mcstar: http://ix.io/4yp has to be written like that 2013-03-23T17:50:32 although you can often use constexpr now 2013-03-23T17:51:00 ok, ill look at it if i fail miserably 2013-03-23T17:51:31 mcstar: it's an unrelated thing ;p 2013-03-23T17:51:35 just shows a working one 2013-03-23T17:51:46 why would it be unrelated? 2013-03-23T17:51:56 you said i should use type lists 2013-03-23T17:52:05 and afaik that paste implements that 2013-03-23T17:52:08 well, lists 2013-03-23T17:52:14 that's not a list of types 2013-03-23T17:52:14 yeah 2013-03-23T17:52:21 but it is related 2013-03-23T17:52:22 isnt it? 2013-03-23T17:52:29 no it's a list of ints 2013-03-23T17:52:36 you can make it a list of types 2013-03-23T17:53:11 http://ix.io/4Rn that's with a type list 2013-03-23T17:53:16 anyway I think you want to use it with a function 2013-03-23T17:53:19 not a struct 2013-03-23T17:54:15 size, hm 2013-03-23T17:54:20 thats nice, i need size 2013-03-23T17:56:41 * thestinger isn't entirely sure if it can be done sanely this way though ;p 2013-03-23T18:08:36 thestinger: 2013-03-23T18:08:38 g++ -std=c++11 nloop.cpp -o nloop |& wc -l 2013-03-23T18:08:40 7312 2013-03-23T18:10:00 lol 2013-03-23T18:10:08 yay C++ 2013-03-23T18:37:29 ugh evil test 2013-03-23T18:39:06 *** NoxiaZ^ has quit IRC (Ping timeout: 264 seconds) 2013-03-23T18:41:28 *** kilae has quit IRC (Quit: ChatZilla 0.9.90 [Firefox 19.0.2/20130307023931]) 2013-03-23T18:45:05 ah shit 2013-03-23T18:45:07 thats my problem 2013-03-23T18:45:12 if is not really a static if 2013-03-23T18:45:17 thestinger: is there a static if? 2013-03-23T18:48:53 mcstar: well, you can use a regular if in a constexpr 2013-03-23T18:49:01 or a ternary in struct metaprogramming 2013-03-23T18:49:18 it seems a regular if is not working 2013-03-23T18:49:20 there's enable_if but it's for disabling a template based on a condition 2013-03-23T18:49:31 mcstar: oh right - a constexpr function has to be 1 expression 2013-03-23T18:49:34 so you need to use the ternary 2013-03-23T18:49:48 * thestinger forgot that detail 2013-03-23T18:50:06 it's an arbitrary limitation they added because microsoft complained. 2013-03-23T18:50:36 thestinger: lets say i want to branch on an integer parameter 2013-03-23T18:50:54 the new integer, n-1 for example is going to be a new parameter of the template 2013-03-23T18:51:05 but if n==0 i dont want to recurse 2013-03-23T18:51:38 return n == 0 ? 0 : f(n); ? 2013-03-23T18:51:46 just has to be 1 return statement expression 2013-03-23T18:51:52 in constexpr functions 2013-03-23T18:51:53 there is no return at all 2013-03-23T18:52:17 mcstar: are you using a struct or a constexpr function? 2013-03-23T18:52:23 struct 2013-03-23T18:52:26 well 2013-03-23T18:52:34 ternary on the right of the assignment should work 2013-03-23T18:52:44 oh wait. 2013-03-23T18:52:47 no it won't. 2013-03-23T18:53:02 mcstar: enable_if might work 2013-03-23T18:53:08 but just use constexpr, it's saner 2013-03-23T18:53:15 you can call the constexpr function in the struct 2013-03-23T18:53:23 the problem is this damn compiler keeps generating structs with template arguments, that cant happen 2013-03-23T18:53:41 constexpr int f(int n) { return n == 0 ? 0 : f(n); } 2013-03-23T18:53:46 or whatever 2013-03-23T18:53:53 constexpr int f(int n) { return n == 0 ? 0 : f(n - 1); } 2013-03-23T18:53:56 ;p 2013-03-23T18:53:57 let me paste something, i dont follow you at all 2013-03-23T18:54:23 I just found a hard to debug bug that has to do with RNG 2013-03-23T18:55:30 thestinger: http://hpaste.org/84580 2013-03-23T18:56:05 the problem with this code, is that gcc keeps generating templates with negative parameters 2013-03-23T18:56:08 but it shouldnt 2013-03-23T18:56:45 this recursive call wont instantiate a Loop with n<0 since it stops at 0 2013-03-23T18:57:03 if 'if' worked at compile time, i think this code should work 2013-03-23T18:57:10 mcstar: the if statement is happening at runtime though, it's not a constexpr function 2013-03-23T18:57:31 so how in the hell should i handle the base case? 2013-03-23T18:57:46 if i do another template, with n==0 it doesnt work 2013-03-23T18:57:54 * thestinger shrugs ;p 2013-03-23T18:58:01 I think this was a bad idea :) 2013-03-23T18:58:18 what? 2013-03-23T18:58:28 using templates for this 2013-03-23T18:58:30 this should work.. 2013-03-23T18:58:39 oh 2013-03-23T18:58:49 mcstar: just make it a plain old function 2013-03-23T18:58:52 here 2013-03-23T18:58:54 sec 2013-03-23T19:00:39 * thestinger forgets how to do this stuff :( 2013-03-23T19:01:36 thats alright 2013-03-23T19:01:39 you will get used to it 2013-03-23T19:01:54 rust has spoiled you 2013-03-23T19:01:59 I have to fix this rust bug ;p 2013-03-23T19:02:08 sure 2013-03-23T19:02:15 the crate id (a hash) depends on the order of the dependencies in a hash table 2013-03-23T19:02:32 and hash tables used a keyed hash (SipHash) so each table has a different order for the same keys 2013-03-23T19:02:49 so with 2 dependencies, you end up with 2 possible hashes, with 3 dependencies it makes 6 2013-03-23T19:03:00 yay for non-deterministic bugs 2013-03-23T19:03:31 * thestinger just needs to switch it to a treemap or trie.... but first I need to find what actually does this ;\ 2013-03-23T19:04:04 anyway that's just my working theory about what causes it to have multiple hashes :P 2013-03-23T19:04:17 I should try 4 deps but I'm 99% sure already 2013-03-23T19:05:30 gl 2013-03-23T19:05:38 I found it! 2013-03-23T19:05:45 it sorts dependencies by crate name 2013-03-23T19:06:02 but... this test case is testing using the same library (same crate name) with a different version 2013-03-23T19:06:11 because symbols are mangled in a way that you can use 2 vers of the same lib 2013-03-23T19:06:23 so the sort order is only based on the name, thus not deterministic 2013-03-23T19:06:37 but the old hash table it was using always used (0, 0) as the 2 SipHash keys 2013-03-23T19:07:22 fixing bugs can be so satisfying :P 2013-03-23T19:08:37 thestinger > blog 2013-03-23T19:08:41 :) 2013-03-23T19:14:09 *** mceier has quit IRC (Ping timeout: 245 seconds) 2013-03-23T19:25:51 *** mceier has joined #aichallenge 2013-03-23T19:39:08 *** NoxiaZ^ has joined #aichallenge 2013-03-23T19:41:51 mcstar: http://ix.io/4Rq/diff my fix :) 2013-03-23T19:42:04 * thestinger hates how ugly the old parts of the compiler code are 2013-03-23T19:42:43 thestinger: that code doesnt tell me much 2013-03-23T19:42:51 and right now i hate languages :) 2013-03-23T19:42:56 mcstar: it sorted only by name before 2013-03-23T19:43:06 ok, but i dont know why is that a problem 2013-03-23T19:43:12 so ones with the same name but a diff version would be in a non-deterministic order 2013-03-23T19:43:15 was it making hash collisions? 2013-03-23T19:43:19 mcstar: no 2013-03-23T19:43:25 ok so crates (libraries) have deps 2013-03-23T19:43:36 so this is some internal stuff? 2013-03-23T19:43:39 each crate has a hash that acts as an id 2013-03-23T19:43:52 like cabal abi hash? 2013-03-23T19:43:57 yes 2013-03-23T19:44:10 so the ABI changes when the dependencies change too 2013-03-23T19:44:17 sure 2013-03-23T19:44:18 you can have 2 versions of a library in the same program 2013-03-23T19:44:25 names are mangled with the id/vers 2013-03-23T19:44:42 ok so there was a test that checked to make sure using 2 crates with the same name but a diff version worked 2013-03-23T19:44:57 and it broke when I switched to the new hash table implementation 2013-03-23T19:45:12 why? because the new hash table gets 2 random keys that it uses for the keyed SipHash 2013-03-23T19:45:29 so the same keys in a table doesn't mean it will have the same order 2013-03-23T19:45:31 'when you switched' what does it mean? told the compiler to use another hashtable for internal purposes? 2013-03-23T19:45:37 or is this for a library manager? 2013-03-23T19:45:40 mcstar: yes, rust's compiler is written in rust 2013-03-23T19:45:48 it bootstraps itself 2013-03-23T19:46:12 it dls a previous snapshot, builds the libraries, then builds the compiler with the new libraries and old snapshot compiler, then uses that to build itself 2013-03-23T19:46:22 so building rust is 3x 4min builds :P 2013-03-23T19:46:36 4 min? 2013-03-23T19:46:38 wtf 2013-03-23T19:46:51 how many lines is the compiler? 2013-03-23T19:46:58 100k-200k lines? 2013-03-23T19:46:59 of rust 2013-03-23T19:47:07 rust gives LLVM a lot of work to do atm 2013-03-23T19:47:11 generates too much IR 2013-03-23T19:47:19 90% of the time is spent in optimization passes 2013-03-23T19:48:33 mcstar: LLVM itself takes like an hour to build 2013-03-23T19:48:46 but you don't need to rebuild it when you're working on rust :) 2013-03-23T19:49:36 mcstar: anyway the issue was that with a randomized hash table, the order of the dep hashes was non-deterministic 2013-03-23T19:49:41 so the crate's id was non-deterministic 2013-03-23T19:50:02 the id would be random, based on the # of possible orders of the dependencies 2013-03-23T19:50:12 assuming they all have the same name (since it sorted by name) 2013-03-23T19:50:21 fix is easy enough - sort by the tuple of (name, vers, hash) 2013-03-23T19:50:36 it was deterministic, wasnt it? but there were multiple possibilities 2013-03-23T19:50:42 mcstar: no 2013-03-23T19:50:46 mcstar: well 2013-03-23T19:50:54 for a given set of packages it didtn change 2013-03-23T19:51:02 mcstar: it would 2013-03-23T19:51:08 mcstar: 2 deps -> 2 possibilities, 50/50 chance 2013-03-23T19:51:20 SipHash is a pseudo-random function, and the hash tables are randomly keyed 2013-03-23T19:51:24 and if you run it, it would produce different results? 2013-03-23T19:51:27 so the hash table order is random 2013-03-23T19:51:30 mcstar: yes 2013-03-23T19:51:31 ah 2013-03-23T19:51:34 brutal 2013-03-23T19:51:53 the old hash table I'm replacing wasn't randomly keyed, always used 0 and 0 as the 2 keys 2013-03-23T19:52:13 *** amstan has quit IRC (Ping timeout: 240 seconds) 2013-03-23T19:52:44 mcstar: I think it was still a bug, it only worked because the hash table was keyed on an id based on the order it found them 2013-03-23T19:52:52 so reordering the deps would have changed the id before 2013-03-23T19:52:59 so either way it's a bug 2013-03-23T19:53:33 luckily there are unit tests to..... find seemingly totally unrelated bugs when you change something... 2013-03-23T19:54:06 this could merit a blog post :P 2013-03-23T19:54:40 sure 2013-03-23T19:54:48 SipHash is pretty awesome btw 2013-03-23T19:55:10 it's about as fast as other good hash table hashes, but it's built as a cryptographic PRF so it's immune to hash collision DoS attacks 2013-03-23T19:55:20 at least if you key it randomly ;p 2013-03-23T19:56:41 still has occasional collisions because the output is small, but they aren't something you can generate enough of to make the table not O(1) 2013-03-23T19:58:15 python should be using it too but they got all NIH syndrome and tried to invent their own crypto in 3.3 :( 2013-03-23T19:58:18 and they failed. 2013-03-23T20:04:50 gtg2 sleep 2013-03-23T20:04:55 *** mcstar has quit IRC (Quit: mcstar) 2013-03-23T20:33:36 *** antimatroidl has quit IRC (Quit: Leaving.) 2013-03-23T20:44:15 *** coeus has quit IRC (Ping timeout: 258 seconds) 2013-03-23T20:53:27 *** smiley1983 has joined #aichallenge 2013-03-23T21:25:30 *** NoxiaZ^ has quit IRC () 2013-03-23T21:48:11 *** capa has joined #aichallenge 2013-03-23T21:52:52 *** capa has quit IRC (Ping timeout: 256 seconds) 2013-03-23T22:02:32 *** sigh has joined #aichallenge 2013-03-23T22:51:37 *** capa has joined #aichallenge 2013-03-23T23:07:32 *** capa has quit IRC (Ping timeout: 255 seconds) 2013-03-23T23:24:10 *** capa has joined #aichallenge 2013-03-23T23:55:26 *** capa has quit IRC ()