2012-04-18T00:04:01 *** thestinger has joined #aichallenge 2012-04-18T00:10:46 *** amstan has quit IRC (Quit: Konversation terminated!) 2012-04-18T00:55:18 *** thestinger has quit IRC (Quit: sleep(28800)) 2012-04-18T01:04:10 *** replore_ has joined #aichallenge 2012-04-18T01:07:40 *** Areks has joined #aichallenge 2012-04-18T01:20:40 *** Accoun has quit IRC (Ping timeout: 244 seconds) 2012-04-18T01:27:58 *** kilae has joined #aichallenge 2012-04-18T02:00:08 *** Fandekasp has quit IRC (Quit: Lost terminal) 2012-04-18T02:02:52 *** Fandekasp has joined #aichallenge 2012-04-18T02:21:37 *** replore_ has quit IRC (Remote host closed the connection) 2012-04-18T02:41:23 *** pairofdice has joined #aichallenge 2012-04-18T02:47:38 *** Palmik has joined #aichallenge 2012-04-18T02:55:24 *** Vrexu has quit IRC (Remote host closed the connection) 2012-04-18T03:04:06 *** Vrexu has joined #aichallenge 2012-04-18T03:06:07 *** kurnevsky has joined #aichallenge 2012-04-18T03:11:18 *** Garf has joined #aichallenge 2012-04-18T04:07:11 *** kurnevsky has quit IRC (Quit: Leaving.) 2012-04-18T04:08:06 *** Fandekasp has quit IRC (Quit: leaving) 2012-04-18T04:40:18 *** mceier has joined #aichallenge 2012-04-18T04:52:23 *** delzex has joined #aichallenge 2012-04-18T04:54:52 *** delzex has quit IRC (Client Quit) 2012-04-18T05:18:42 *** Vrexu has quit IRC (Remote host closed the connection) 2012-04-18T05:33:55 *** mcstar has joined #aichallenge 2012-04-18T06:03:20 mcstar: http://forum.dlang.org/thread/jlvge6$trk$1@digitalmars.com?page=3#post-mailman.1649.1334228692.4860.digitalmars-d:40puremagic.com :D 2012-04-18T06:03:41 *** Areks has quit IRC (Ping timeout: 272 seconds) 2012-04-18T06:04:33 now how do you read from a file in haskell ? 2012-04-18T06:04:58 mleise: hi 2012-04-18T06:05:11 hi 2012-04-18T06:05:50 it is easy to read from a file, what do you mean? 2012-04-18T06:06:03 readFile "file" 2012-04-18T06:09:39 oh ... that's really simple. you don't need to explain category theory first it seems 2012-04-18T06:09:49 *** Garf has quit IRC (Quit: Make a new plan, Stan!) 2012-04-18T06:10:04 no i dont 2012-04-18T06:10:39 mleise: ofc, this is a recommended read http://www.haskell.org/haskellwiki/Typeclassopedia 2012-04-18T06:11:03 ah, i think you already knew that 2012-04-18T06:11:39 Yes, and for an outsider that is just overwhelming. 2012-04-18T06:12:18 uhhh 2012-04-18T06:12:28 Even with good explanations it is often difficult to see the benefit of changes. Like what is partial function application? 2012-04-18T06:12:45 "It gets worse when you go: "How does this help 2012-04-18T06:12:49 read from a file" and they give you a long stare and start all over 2012-04-18T06:12:51 again, I just want to know how to read from a goddamn file!" 2012-04-18T06:12:53 ^^^ rofl 2012-04-18T06:13:04 hehe 2012-04-18T06:13:10 :D 2012-04-18T06:13:21 mleise: you kidding right? you must know what is partial function application 2012-04-18T06:13:34 one thing i hate is CL is that you need a lambda for that 2012-04-18T06:13:40 no, I'm not. guess why i never touched FP 2012-04-18T06:14:09 *** foRei has joined #aichallenge 2012-04-18T06:14:13 it's all so mathsy 2012-04-18T06:14:13 mleise: even c++ guys use that all the time 2012-04-18T06:14:27 (i know i did when i wrote c++) 2012-04-18T06:16:13 mleise: do you really argue with, that this file is readable? http://hpaste.org/67201 2012-04-18T06:16:21 *** Areks has joined #aichallenge 2012-04-18T06:17:16 (this code does flying objects and collision detection, so i called it asteroids, though, it is far from that) 2012-04-18T06:17:19 Ship Double Double Double Double Double 2012-04-18T06:17:37 x y orinetation vx vy 2012-04-18T06:17:47 mcstar: what does "data FColor = .... dereived ( ... )" mean? 2012-04-18T06:17:54 derived 2012-04-18T06:18:16 dereiving 2012-04-18T06:18:17 pairofdice: i oculd have used record syntax, but i wanted to keep the data declarations in the same file 2012-04-18T06:18:22 deriving 2012-04-18T06:18:29 (and it would have polluted namespace a bit) 2012-04-18T06:18:40 mleise: that is a new data type 2012-04-18T06:18:45 in brackets ... are functions used on that data type? 2012-04-18T06:18:52 and the stuff in the middle are fields? 2012-04-18T06:19:32 deriving (something) , means the compiler figures out automatically how to make that data type part of a typeclass 2012-04-18T06:19:43 Haskell is one of those things lots of people urge to have on your to-grok -list 2012-04-18T06:19:46 Oo it does _what_ ??? 2012-04-18T06:20:06 oh wait ... category theory? 2012-04-18T06:20:21 But not now :) 2012-04-18T06:20:32 mleise: Show means, you will be able to print the values of FColor, Eq means, you can compare two FColors, for equality, and Ord means, you can have ordering among them 2012-04-18T06:20:52 ok ok, so can I imagine that as a C++ interface? 2012-04-18T06:21:19 i think they sometimes compare typeclasses to java interfaces 2012-04-18T06:21:21 loosely 2012-04-18T06:21:53 keep in mind, that i could have given descriptive names to all those Double's 2012-04-18T06:21:55 like: 2012-04-18T06:22:14 data Ship = Ship {x :: Double, y :: Double,...} 2012-04-18T06:22:17 *** Garf has joined #aichallenge 2012-04-18T06:22:19 *** coeus has joined #aichallenge 2012-04-18T06:22:42 so later, i could have written: x aship 2012-04-18T06:22:44 ah, I'd really appreciate that in other people's code to understand the data types 2012-04-18T06:22:46 or: 2012-04-18T06:22:53 aship{y=34} 2012-04-18T06:24:17 mleise: data SO = SO FColor SceneObject deriving Show 2012-04-18T06:24:27 this is more interesting, when you can combine types 2012-04-18T06:25:04 btw, | means choices in type declarations 2012-04-18T06:25:15 ... 2012-04-18T06:25:25 data Int = 0 | 1 | 2 | ... 2012-04-18T06:25:34 you could define integers liek that 2012-04-18T06:25:49 0,1,2 is the data constructor here 2012-04-18T06:25:51 but there is only one type Int in a module, right? 2012-04-18T06:25:55 just like Ship, Rock 2012-04-18T06:26:03 yes 2012-04-18T06:26:16 you cant have name conflicts 2012-04-18T06:26:34 so SO = SO ... means ... class inheritance like in C++ ? 2012-04-18T06:27:07 hmm that makes no sense to me now that i think about it 2012-04-18T06:27:22 how does haskell know what SO is, when it wasn't previously defined 2012-04-18T06:27:33 no, it is a new type SO, which has a value constructor SO, and take 2 parameters, of type FCOlor and SceneObject 2012-04-18T06:27:59 SO is introduced here: data SO 2012-04-18T06:28:13 ah, so you repeat the type name there as the return value of the constructr 2012-04-18T06:28:31 btw, you dont have to structure your code, so that every definition of everything you use, must come before the code 2012-04-18T06:28:52 SO is the new type's name, and the contructor's too 2012-04-18T06:28:56 class SO { SO construct(FColor, SceneObject); } 2012-04-18T06:29:23 but it is not a class 2012-04-18T06:29:48 not even roughly ;) 2012-04-18T06:29:50 ? 2012-04-18T06:29:51 nothing good comes from trying to understand them from that perspective 2012-04-18T06:30:04 something will trip you up later, as they say 2012-04-18T06:30:10 oh come on, you have to fetch me from where I stand 2012-04-18T06:30:23 I only know classes and structs and all that stuff 2012-04-18T06:31:35 if you are interested read this http://www.haskell.org/haskellwiki/OOP_vs_type_classes 2012-04-18T06:31:58 i dont think my ideas about the language are really firm 2012-04-18T06:32:03 so i dont want to mislead you 2012-04-18T06:32:04 hmm, I'll give it a look 2012-04-18T06:32:15 though, i think im correct most of the time 2012-04-18T06:32:45 *** sigh has joined #aichallenge 2012-04-18T06:32:51 mleise: but you really need to distinguis between types and type classes 2012-04-18T06:33:18 sure I do. D has "ranges" for example 2012-04-18T06:33:25 whats that? 2012-04-18T06:33:33 they are no manifest type, but a set of operations available on any type 2012-04-18T06:33:59 so every type specializes a 'range' ? 2012-04-18T06:34:19 Actually they are just "if"s that check if a type has certain methods 2012-04-18T06:34:32 :) 2012-04-18T06:34:55 so an array offers the property .length, opIndex etc. 2012-04-18T06:35:21 and then it qualifies as a random access range by definition 2012-04-18T06:35:33 is that similar to type classes? 2012-04-18T06:37:34 well, not really 2012-04-18T06:38:00 type classes try to provide some operation on structures 2012-04-18T06:38:27 so when you implement the required operation for a new type,it will be part of that type class 2012-04-18T06:39:04 but it isnt about those kinds of abstractions, like providing random access 2012-04-18T06:40:24 "some operations" sounds to me just like that 2012-04-18T06:41:06 the functionality "Show" in your example allows the object to be printed by whatever mechanism there is in haskell 2012-04-18T06:41:31 and the functionality "length" and others allow a type to be used in interations and indexing in D 2012-04-18T06:42:30 *** Garf has quit IRC (Quit: Make a new plan, Stan!) 2012-04-18T06:42:34 So whatever the type is, it can be classified as "showable" or "indexable" 2012-04-18T06:42:58 yes, the Show typeclass requires a 'show' function to work on your data type, that must take your data, and make a string out of it 2012-04-18T06:43:04 but 2012-04-18T06:43:16 there is now typeclass that provides iteration for example 2012-04-18T06:43:38 usually, type classes used differently in haskell, than in other languages 2012-04-18T06:43:43 i mean in oop languages 2012-04-18T06:44:34 what all these typeclasses try to really do, is implement compositional properties for your types 2012-04-18T06:44:37 *** antimatroid has quit IRC (Ping timeout: 252 seconds) 2012-04-18T06:44:58 that's fine. i understand that approach 2012-04-18T06:45:09 *** delt0r_ has quit IRC (Ping timeout: 244 seconds) 2012-04-18T06:45:32 now if I give the array a method "toString()" it is a random access range and printable 2012-04-18T06:45:58 I can add more 'concepts' to the data type if I need them 2012-04-18T06:46:17 where the concepts would be either provided by the standard library or my own code 2012-04-18T06:48:02 I didn't like the way it was done in D much. I preferred strict interfaces. That makes me think: The "Show" in your code - is it a function name or some aggregate 'type' that can include a whole bunch of functions 2012-04-18T06:50:15 Show is the name of a typeclass and you need to provide the 'show' function for that 2012-04-18T06:50:38 basically, Show is parameterized over types 2012-04-18T06:50:39 ok, so it really is something I have to think of as a Java interface 2012-04-18T06:51:31 e.g. It adds an explicit requirement in terms of offered methods to a type. 2012-04-18T06:52:15 In D it is all implicit. You can have a typo in a method name and things may behave strange. 2012-04-18T06:52:33 *** alehorst1 has quit IRC (Quit: Leaving.) 2012-04-18T06:53:10 E.g. A random access range becomes a forward range and cannot be indexed any more, resulting in more or less comprehensable error messages when you use algorithms that need indexing. 2012-04-18T06:54:43 in haskell you must provide a minimal generator set of functions for your typeclass 2012-04-18T06:54:49 with the proper signature 2012-04-18T06:56:12 minimal generator set means what ? comparison and arithmetics? 2012-04-18T06:56:24 no 2012-04-18T06:56:29 type construction? 2012-04-18T06:57:00 means a typeclass, can require different functions for it to work, and it can define those in terms of others 2012-04-18T06:57:19 and you only need to provide so much for it to work, not all of them 2012-04-18T06:57:25 so many* 2012-04-18T06:57:28 *** delt0r_ has joined #aichallenge 2012-04-18T06:57:55 an example is == and /= 2012-04-18T06:58:06 *** antimatroid has joined #aichallenge 2012-04-18T06:58:28 x==y = not x/=y 2012-04-18T06:58:38 x/=y = not x==y 2012-04-18T06:58:53 these are the two operations the Eq typeclass needs 2012-04-18T06:58:59 Ok, that's compiler magic that works in many languages 2012-04-18T06:59:04 and you only need to provide == or /= 2012-04-18T06:59:09 no 2012-04-18T06:59:19 what compiler magic? 2012-04-18T06:59:34 The compiler knows internally that equals is the inverse of not equals 2012-04-18T06:59:53 or does the class Eq define these operations 2012-04-18T06:59:55 i just stated it, the compilers no jackshit about it 2012-04-18T06:59:59 knows* 2012-04-18T07:00:27 == and /= are no dfferent from someFunction 2012-04-18T07:00:53 or .\=* which you call an operator, but is like a function ike any other 2012-04-18T07:01:15 in haskell there is only a tiny distinction between operators and functions 2012-04-18T07:01:40 and the typeclass Eq provides the information that you only need to define either == or /= for it to work? 2012-04-18T07:01:59 symbols made from non alphanumeric characters are treated as infix, and others are prefix 2012-04-18T07:02:16 class Eq a where 2012-04-18T07:02:31 (==) :: a -> a -> Bool 2012-04-18T07:02:33 (/=) :: a -> a -> Bool 2012-04-18T07:02:39 x==y = not x/=y 2012-04-18T07:02:43 x/=y = not x==y 2012-04-18T07:02:52 this is the definition of the typeclass Eq 2012-04-18T07:03:17 that's neat. now I understand in part why this system is good 2012-04-18T07:03:56 a here, is a type variable 2012-04-18T07:04:02 like a template parameter 2012-04-18T07:04:48 "on any a offer a method that takes an a and returns a bool" 2012-04-18T07:05:29 again, 'a' does not offer a method 2012-04-18T07:05:59 :( 2012-04-18T07:06:31 maybe I'll try to convert your pasted code snippet to D to understand what it really does 2012-04-18T07:06:49 ^^ this? 2012-04-18T07:07:07 the one in that haskell paste site of course ;) 2012-04-18T07:07:12 ah 2012-04-18T07:07:19 is it a snippet? 2012-04-18T07:07:25 it is a complete working program 2012-04-18T07:07:45 do you really want to translate it? 2012-04-18T07:07:53 it would be fun 2012-04-18T07:08:04 does D have gtk bindings? 2012-04-18T07:08:08 XD 2012-04-18T07:08:38 yes it does, good ones even! 2012-04-18T07:08:42 im kidding 2012-04-18T07:08:49 everything has gtk bindings 2012-04-18T07:09:03 i dont know how good haskell's is 2012-04-18T07:09:07 well, it needs someone to write them 2012-04-18T07:09:12 it was easy, but i really cant compare 2012-04-18T07:09:17 (im a qt guy) 2012-04-18T07:09:19 there are mediocre qt4 bindings for example 2012-04-18T07:09:29 and not so good wxWidgets bindings 2012-04-18T07:09:46 mleise: but do you really want to translate that code? 2012-04-18T07:09:51 or you were just kidding 2012-04-18T07:09:52 Gtk+ is the only GUI toolkit that currently just works 2012-04-18T07:10:21 no I really want to translate that code to see what the constructs in Haskell do and what I miss or don't miss out on 2012-04-18T07:10:35 but that is just a beginner's code 2012-04-18T07:10:39 and it is a first pass 2012-04-18T07:10:54 i mean i didnt rewrite anything 2012-04-18T07:10:55 I'm not an expert in D either 2012-04-18T07:11:06 come on, you must be a much better programmer than me 2012-04-18T07:11:16 i know you are 2012-04-18T07:11:37 lol, how do you think that? I don't even know partial function application 2012-04-18T07:11:48 but I sure know some ASM 2012-04-18T07:11:49 but you write code for aliving 2012-04-18T07:12:03 Yes, and you will soon enough I think 2012-04-18T07:12:12 well, i do per say 2012-04-18T07:12:19 but this is a tiny project 2012-04-18T07:12:24 (i mean the Qt one) 2012-04-18T07:13:10 Actually it only ever used Java and Delphi in the business world and a bit of ASP.net 2012-04-18T07:13:25 s/it/I/ 2012-04-18T07:13:58 you know the time when you talk about yourself in the third person ... 2012-04-18T07:14:14 that code is under 200 lines, and i wrote it in 8 hours, i think im a lousy programmer 2012-04-18T07:14:32 though, i had to dig in the documentations 2012-04-18T07:14:49 mleise: yes, sign of insanity 2012-04-18T07:14:55 * mcstar likes that 2012-04-18T07:15:15 sure, I'm not particularly fast either. I cannot type down a program without stopping 2012-04-18T07:15:31 mleise: i think you can do it in 100 lines 2012-04-18T07:15:39 I'm always stopping to think if what I just wrote makes sense 2012-04-18T07:15:50 100 lines of haskell 2012-04-18T07:15:54 no, D 2012-04-18T07:15:57 Oo 2012-04-18T07:16:12 you know we use { and } and the likes ? 2012-04-18T07:16:13 look, my imports alone 12 lines 2012-04-18T07:16:32 mleise: only counting meaningful ines 2012-04-18T07:16:35 lines* 2012-04-18T07:16:55 a struct definition has every field on a separate line as well 2012-04-18T07:17:08 i think it will be much longer 2012-04-18T07:17:13 *** antimatroid has quit IRC (Ping timeout: 264 seconds) 2012-04-18T07:17:19 anyway, lets see 2012-04-18T07:17:24 than we cmpare speeds 2012-04-18T07:17:34 oh ... you don't really want that 2012-04-18T07:17:51 why? are you too good in optimizations? 2012-04-18T07:18:15 I claim to be good at it, but the GCC is even better at it ;) 2012-04-18T07:18:37 it will be 10 times faster than the haskell code 2012-04-18T07:18:39 ghc is good at it too 2012-04-18T07:18:42 oh 2012-04-18T07:18:50 well, maybe ... 2 times 2012-04-18T07:18:59 yeah, thats more reasonable 2012-04-18T07:19:12 anyway time for lunch 2012-04-18T07:19:30 mleise: when will you do it? 2012-04-18T07:19:47 this evening 2012-04-18T07:20:05 ill be around, so you can aske me, if you need to 2012-04-18T07:20:06 hey, you could have commented your code 2012-04-18T07:20:13 i dont comment, ever 2012-04-18T07:20:52 you should have seen my Ants entry... 2012-04-18T07:24:25 0 comments 2012-04-18T07:25:20 you too? 2012-04-18T07:25:26 Pretty much, yea 2012-04-18T07:25:30 hehe, well. when you work for money you should leave comments 2012-04-18T07:25:45 it helps others in the team and thos who come after you 2012-04-18T07:26:08 the first thing you will notice is the absence of good comments when you start a at a new job 2012-04-18T07:26:27 *noone* writes them, but *everyone* misses them 2012-04-18T07:27:07 for ants it may be ok, because you neither reuse or share the code 2012-04-18T07:27:22 well ... actually you did share it, but you get the point 2012-04-18T07:27:46 i think comments would just get in the way, and destroy readability 2012-04-18T07:27:57 the problem was, that my code was lame/unstructured 2012-04-18T07:28:33 My code was uhh, let's not talk about my code 2012-04-18T07:28:43 yeah, i second that 2012-04-18T07:29:54 I only worked on it for the first ~week of the competition 2012-04-18T07:34:15 *** antimatroid has joined #aichallenge 2012-04-18T07:34:28 *** GarfTop has joined #aichallenge 2012-04-18T09:02:53 *** amstan has joined #aichallenge 2012-04-18T09:02:53 *** ChanServ sets mode: +o amstan 2012-04-18T10:06:33 *** coeus has quit IRC (Quit: Verlassend) 2012-04-18T10:32:40 *** NoxiaZ^ has joined #aichallenge 2012-04-18T10:32:53 *** kurnevsky has joined #aichallenge 2012-04-18T10:37:18 *** Areks has quit IRC (Ping timeout: 272 seconds) 2012-04-18T10:38:27 *** thestinger has joined #aichallenge 2012-04-18T10:42:50 mcstar: I tried your collision thing btw 2012-04-18T10:42:57 I only used cabal for mersenne-random though 2012-04-18T10:43:14 you had gtk already> 2012-04-18T10:43:17 ? 2012-04-18T10:43:45 no, used the arch linux package :P 2012-04-18T10:44:02 i decided not to install things that way 2012-04-18T10:44:43 thestinger: mleise decided to rewrite it in D 2012-04-18T10:44:58 he says he hates haskell, and really cant stand the code 2012-04-18T10:46:15 doing cs212 (taught by peter norvig) and udacity's crypto course 2012-04-18T10:46:42 yeah, for example, what does "where a b = someFunc ..." mean ? 2012-04-18T10:47:04 how can anyone understand this pile of crap? 2012-04-18T10:47:12 it has no clear structure or anything 2012-04-18T10:47:19 yes it does 2012-04-18T10:47:33 indentation is significant, like python 2012-04-18T10:47:42 you can choose to use braces but no one does 2012-04-18T10:47:53 but this line in mcstar's code is not indented 2012-04-18T10:48:36 which? 2012-04-18T10:48:38 it's basically just a local function definition (for that block) 2012-04-18T10:48:39 it is the last in a sequence of "do" operations 2012-04-18T10:48:49 mleise: line number? 2012-04-18T10:48:55 180 2012-04-18T10:49:16 I understand the glib part, but not the haskell part 2012-04-18T10:49:42 mleise: it's a local function definition (for the block above) 2012-04-18T10:49:43 cs 253 web app engineering's only homework was to set-up google app engine 2012-04-18T10:49:44 form definitions follow after where 2012-04-18T10:49:52 it is quite self explanatory 2012-04-18T10:50:05 form definitions? 2012-04-18T10:50:08 yes 2012-04-18T10:50:15 something = 2012-04-18T10:50:19 let's start with the block above 2012-04-18T10:50:22 something some other = 2012-04-18T10:50:42 doPeriodic $ do (w, h) <- ... 2012-04-18T10:50:46 something can be a substitution, or it can have parameters 2012-04-18T10:50:51 (you call it function) 2012-04-18T10:50:53 is that a proper inner function 2012-04-18T10:51:03 it is an action 2012-04-18T10:51:15 it is not a lambda or function 2012-04-18T10:51:34 but that isnt like 'where' 2012-04-18T10:51:36 so ... just a block of code? 2012-04-18T10:52:04 it must have a proper type 2012-04-18T10:52:17 what is the type of doPeriodic? 2012-04-18T10:52:21 it has IO (Bool) 2012-04-18T10:52:47 you can see, that it passes that action to timeoutAdd 2012-04-18T10:52:54 I can't make out where the "$" ends, i.e. where the ) bracket would be if you wrote ( ...) instead of $ 2012-04-18T10:53:11 just follow indentation 2012-04-18T10:53:41 $ is just there, so that i dont have to put in () the whole action 2012-04-18T10:54:02 the *whole* action, so that means down to line 77 2012-04-18T10:54:04 177 2012-04-18T10:54:09 yes 2012-04-18T10:54:57 ok, understood. "doPeriodic ( ... ) " defines a new action. let us call it a closure with no arguments 2012-04-18T10:54:58 mcstar: seems like I have an older version of your code 2012-04-18T10:55:29 thestinger: technically, the difference is the window size and refreash rate 2012-04-18T10:55:44 mcstar: you may want to use Gtk's MainWindow. The application automatically terminates when the last MainWindow is closed 2012-04-18T10:55:46 mleise: no 2012-04-18T10:55:51 yes 2012-04-18T10:55:58 doPeriodic does not define a new action 2012-04-18T10:56:24 but ... it is a block of code with a name, right? 2012-04-18T10:56:28 mleise: do mcstar is teaching you haskell? :P 2012-04-18T10:56:28 no 2012-04-18T10:56:38 is .. teching 2012-04-18T10:56:55 weird, the algo-class stopped posting new content 2012-04-18T10:56:58 :\ 2012-04-18T10:57:04 mleise: 'do something' introduces an action 2012-04-18T10:57:13 doPeriodic takes an action as parameter 2012-04-18T10:57:21 thestinger: yes, he doesn't really want to, but with his own code as the basis it works :p 2012-04-18T10:57:35 wait, you lost me there 2012-04-18T10:57:55 where is that action parameter visible? 2012-04-18T10:58:04 i only see "doPeriodic ( ... )" 2012-04-18T10:58:11 doPeriodic action = timeoutAdd action 10 2012-04-18T10:58:32 but ... above you defined it as just a squence of commands 2012-04-18T10:58:45 how can it suddenly take a parameter 2012-04-18T10:58:52 is it a template? 2012-04-18T10:59:10 the action, the argument to doPeriodic is a sequence of other actions 2012-04-18T10:59:29 mcstar: http://ompldr.org/vZGY2aw basically the same stuff we did in week1 of the coursera crypto class :P 2012-04-18T10:59:36 nice way to review it 2012-04-18T11:00:01 2-3 minute videos with a quiz between each is easier to digest than big 30 min lectures with 1 quiz 2012-04-18T11:00:54 mleise: doPeriodic is just like any other function, here it is just a shorthand for timeoutAdd 2012-04-18T11:00:55 mcstar: you said doPeriodic is an action, now it takes an action as a parameter 2012-04-18T11:00:56 I expect the homework won't be nearly as challenging as the coursera stuff though 2012-04-18T11:01:19 *** kilae has quit IRC (Quit: ChatZilla 0.9.88.2 [Firefox 11.0/20120312181643]) 2012-04-18T11:01:33 mleise: whats wrong with that? 2012-04-18T11:01:46 functions take functions as parameters too 2012-04-18T11:01:56 *is* it an action or does it *take* an action 2012-04-18T11:02:09 you call something an action, cause it has a bit different type signature, it has -> IO (a) 2012-04-18T11:02:22 since it takes an action, it will become one too 2012-04-18T11:02:32 ok, so this is more of an internal distinction 2012-04-18T11:02:42 to allow for non-pure code 2012-04-18T11:02:49 that works in sequence 2012-04-18T11:02:57 etc. 2012-04-18T11:03:00 here the order matters 2012-04-18T11:03:03 not pureness 2012-04-18T11:03:44 the 'return type' of doPeriodic is determined by the last action, i.e. return True 2012-04-18T11:04:53 Finished with week1 of the 4 udacity courses in a bit 2012-04-18T11:05:13 even in these cases, you can just use substitution as the programming model, to understand whats going on 2012-04-18T11:05:19 the problem is with IORef 2012-04-18T11:05:28 I'm still not quite sure what doPeriodic is now. It doesn't seem to take any parameters (line 157), but you say it takes an action as the parameter 2012-04-18T11:05:29 since that really introduces mutable state 2012-04-18T11:05:29 pairofdice: how are the two I haven't signed up for? :P (I'm taking the cs212 and crypto atm) 2012-04-18T11:05:44 crypto will be review now... and I don't think cs212 will be hard 2012-04-18T11:05:54 the homework was one liners :P 2012-04-18T11:06:06 mleise: wha do you mean? everything that comes after $ is the parameter of doPeriodic 2012-04-18T11:06:07 programming languages had reg exp, cs253 basics of html 2012-04-18T11:06:11 and http 2012-04-18T11:06:20 might as well take them 2012-04-18T11:06:24 ok big misunderstanding then :p 2012-04-18T11:06:27 I hope they end up doing harder courses 2012-04-18T11:07:01 mleise: doPeriodic $ do this; that; return some == doPeriodic (do this; that; return some) 2012-04-18T11:07:16 pairofdice: the format of udacity's stuff is _way_ better than the coursera ones 2012-04-18T11:07:18 but the depth isn't there 2012-04-18T11:07:37 Yeah, I guess they're building up to more challenging stuff 2012-04-18T11:07:51 what did I actually learn in cs373? not very much 2012-04-18T11:08:11 I learned a lot more about pathfinding in graphs in the 1 week that the algo-class covered it 2012-04-18T11:08:17 is doPeriodic defined by you, a library or built-in ? 2012-04-18T11:08:24 but I did have to make myself watch really long boring lectures :P 2012-04-18T11:08:37 mleise: hm 2012-04-18T11:08:37 But I don't want stuff that is way over my head 2012-04-18T11:08:41 you dont get it 2012-04-18T11:08:51 it is defined after 'where' 2012-04-18T11:09:07 pairofdice: the difficulty of algo-class wasn't much higher than cs373 2012-04-18T11:09:08 line 180 2012-04-18T11:09:10 but I learned a lot more 2012-04-18T11:09:11 you define stuff after it is used ?!? why on earth? :p 2012-04-18T11:09:14 cs373 was a lot more fun though 2012-04-18T11:09:29 mleise: i told you way before, that you can do this 2012-04-18T11:09:31 mleise: it's a style choice 2012-04-18T11:09:43 not just that 2012-04-18T11:09:54 mleise: http://www.haskell.org/haskellwiki/Declaration_vs._expression_style 2012-04-18T11:09:55 i dont need that function anywhere else 2012-04-18T11:09:57 *** Accoun has joined #aichallenge 2012-04-18T11:10:02 so i use where to define it 2012-04-18T11:10:07 using let everywhere gets you bogged down in the details 2012-04-18T11:10:09 this will only be visible in main 2012-04-18T11:10:10 ok, let's assume top posting and use before declaration was a good idea in the first place. 2012-04-18T11:10:17 now i can look at the where clause 2012-04-18T11:10:31 *** sigh has quit IRC (Remote host closed the connection) 2012-04-18T11:10:58 mleise: you are right about the closure part, i needed to define that action in-line, so that it captures all those other vars 2012-04-18T11:11:24 if i wanted to define it in a where, i should have passed to it a lot of parameters 2012-04-18T11:12:23 thestinger: thx for the link 2012-04-18T11:13:31 actually, i had to do it that way, cause timeoutAdd takes a simple action, and doest parameterize it 2012-04-18T11:14:32 so you wrapped the closure into a simple non-param function 2012-04-18T11:14:40 hm, well i could have parameterized it fully, before i pass it 2012-04-18T11:14:56 thats why i call it a form 2012-04-18T11:14:59 not a function 2012-04-18T11:16:11 pairofdice: http://ompldr.org/vZGY2dg that's what week1 of coursera's crypto looked like 2012-04-18T11:16:13 for comparison 2012-04-18T11:16:28 you can assume those videos just have 1-3 short "enter a number/equation" quizzes 2012-04-18T11:17:28 Does "where doPeriodic action = timeoutAdd action 10" mean, in C style: timeoutAdd(void function() { doPeriodic(); }, 10); 2012-04-18T11:17:49 crypto people like their math notation 2012-04-18T11:18:16 thestinger: are you using 'import' ? 2012-04-18T11:18:33 ? 2012-04-18T11:18:38 try it 2012-04-18T11:18:52 oh, imagemagick? 2012-04-18T11:18:59 I just use scrot 2012-04-18T11:19:06 scrot -s and then drag over the area I want to capture 2012-04-18T11:19:18 k 2012-04-18T11:19:43 mcstar: the only time I deal with import is when I forget to put a shebang on my python scripts 2012-04-18T11:19:48 mleise: well, roughly 2012-04-18T11:19:58 the first string is usually 'import' and that gets executed to run the script 2012-04-18T11:19:59 :) 2012-04-18T11:20:15 i just typed it yesterday, without realizing im not in ghci 2012-04-18T11:23:24 Udacity has plans to sell info to potential employers or something, as a funding model 2012-04-18T11:24:03 thestinger: that remonds me, ganger has 46K $ already 2012-04-18T11:24:07 reminds* 2012-04-18T11:24:09 pairofdice: too easy to get 100% on everything though 2012-04-18T11:24:17 how will they differentiate students? 2012-04-18T11:24:18 Yeah, this far 2012-04-18T11:24:54 I got 100% on every cs373 homework just by writing some unit tests, and the exam was trivial due to their new grading method 2012-04-18T11:25:09 now that they have this new grading, it seems hard to not get 100% :P 2012-04-18T11:25:26 since they tell you if you're right/wrong and you can try any number of times o_o 2012-04-18T11:25:41 I thought it was odd that cs373 exam let you do that 2012-04-18T11:25:50 Since AI class didn't 2012-04-18T11:26:27 the exam was a lot easier than the homework assignments 2012-04-18T11:26:29 imo 2012-04-18T11:26:33 a lot 2012-04-18T11:26:47 the homework assignments made you do something new 2012-04-18T11:26:51 the exam was just trivial review 2012-04-18T11:26:59 and it didn't cover the second half of the course 2012-04-18T11:27:07 just up to pathfinding 2012-04-18T11:27:37 I did pretty much exactly the same thing for the exam assignment as for the project euler triangle thing 2012-04-18T11:27:51 the cs101 exam was harder :P 2012-04-18T11:28:10 pairofdice: I just filled in values from the right 2012-04-18T11:28:25 replacing the one that was already there if the new one was lower 2012-04-18T11:28:27 #67 euler 2012-04-18T11:28:28 *** iglo has joined #aichallenge 2012-04-18T11:28:34 yeah, I remember that 2012-04-18T11:57:01 *** kilae has joined #aichallenge 2012-04-18T12:11:53 im glad that only one thing was problematic 2012-04-18T12:15:57 *** iglo has quit IRC (Remote host closed the connection) 2012-04-18T12:25:01 *** iglo has joined #aichallenge 2012-04-18T12:25:45 thestinger: found this on hpaste: http://hpaste.org/67205 2012-04-18T12:33:18 *** cyphase has quit IRC (Read error: Connection reset by peer) 2012-04-18T12:39:05 back from telephone 2012-04-18T12:39:47 back from washing my muddy shoes 2012-04-18T12:40:10 actually, it was manor too 2012-04-18T12:40:17 or manuer? 2012-04-18T12:40:21 manure? 2012-04-18T12:40:41 manure 2012-04-18T12:40:55 But I guess you could've been washing your manor too 2012-04-18T12:41:18 my manor needs no washing 2012-04-18T12:41:43 (ive been gardening) 2012-04-18T12:44:30 mcstar: the lines below the where clause belong to the where, because they are indented. you define the variables makeShips and makeRocks there using pattern matching, right? 2012-04-18T12:45:06 pff i closed the paste 2012-04-18T12:45:29 but you know your code ;) are these two dimensional arrays? 2012-04-18T12:45:51 ctrl shift t 2012-04-18T12:46:01 i just learned this, when i tried to open a new console in firefox 2012-04-18T12:46:09 instead it brought me an closed tab back 2012-04-18T12:46:22 mleise: those are simple functions 2012-04-18T12:47:07 you can pattern match on any argument 2012-04-18T12:47:15 _ means something i dont care about 2012-04-18T12:47:23 i know 2012-04-18T12:47:45 so they are like what I would call generators 2012-04-18T12:47:52 when you pattern match on something, you use the value constructor of that type 2012-04-18T12:48:01 i dont know what they are 2012-04-18T12:48:11 these are simple function definitions 2012-04-18T12:48:14 ok 2012-04-18T12:48:26 why are they indented then? 2012-04-18T12:48:38 they belong to 'where' 2012-04-18T12:48:58 if they were on the left side, they would be global functions like 'main' 2012-04-18T12:48:59 they are used in main though 2012-04-18T12:49:07 yes, thats why 2012-04-18T12:49:21 i only use them in main, so i used a 'where' to introduce them 2012-04-18T12:49:43 so if you defined a function in main, it would be globally visible? 2012-04-18T12:49:51 ? 2012-04-18T12:49:57 (i.e. with only one indentation level) 2012-04-18T12:50:00 main is just like any other top level definition 2012-04-18T12:50:13 you cant define something like that 2012-04-18T12:50:23 is haskell not scoped like C? 2012-04-18T12:50:37 but you get something backwards here 2012-04-18T12:50:54 if something is defined on the top level, anything can see it 2012-04-18T12:51:02 like main 2012-04-18T12:51:06 yes 2012-04-18T12:51:06 main is not indented 2012-04-18T12:51:09 no 2012-04-18T12:51:18 just like many things before it 2012-04-18T12:52:03 so i though everything with at least 1 level of indentation is inside whatever was not indented above it 2012-04-18T12:52:14 but if in some form definition, i introduce a 'where', all that comes in that form, will be visible only in the part, that the 'where' belongs to 2012-04-18T12:52:35 i do understand that part 2012-04-18T12:52:50 mleise: that indentation part is correct 2012-04-18T12:53:08 however, i cant just define functions and give them names, simply by indenting them 2012-04-18T12:53:12 this is bad: 2012-04-18T12:53:18 but im puzzled by the fact, that if you defined that stuff directly in main (with 1 level of ind.) it would be globally visibl 2012-04-18T12:53:21 main = myfun 4 2012-04-18T12:53:25 myfun x = x 2012-04-18T12:53:55 yes, that looks worrysome 2012-04-18T12:53:56 mleise: no! i never said that 2012-04-18T12:54:39 mleise: where do you get this idea? 2012-04-18T12:55:05 (18:48:23) mcstar: if they were on the left side, they would be global functions like 'main' 2012-04-18T12:55:15 haha 2012-04-18T12:55:19 oh you meant on the *far* left side 2012-04-18T12:55:20 on the left side=not indented 2012-04-18T12:55:30 main = myfun 4 2012-04-18T12:55:31 i meant on the same level as where 2012-04-18T12:55:32 myfun x = x 2012-04-18T12:55:41 why not on the same level as where then? 2012-04-18T12:56:03 because where makes it possible to define some meaning to some symbol 2012-04-18T12:56:11 and you need to indent to keep it in where 2012-04-18T12:56:33 you need to add 1 space indentation relative to where 2012-04-18T12:56:38 so you need where to even declare the rocks and ships functions? 2012-04-18T12:56:41 (at least) 2012-04-18T12:56:57 yes, if i dont want them on the top level 2012-04-18T12:57:07 alright 2012-04-18T12:57:09 just like doPeriodic 2012-04-18T12:57:28 mleise: you can break line after where, but you must indent 2012-04-18T12:57:36 its funny. i dont quite get doPeriodic yet 2012-04-18T12:57:41 :( 2012-04-18T12:57:44 simplest thing ever 2012-04-18T12:57:54 think of it like a substitution 2012-04-18T12:58:25 let me compare it with makeShips 2012-04-18T12:59:07 doPeriodic (<- symbol name) action (<- a parameter) = timeoutAdd action 10 (<- what the function does) 2012-04-18T12:59:45 you would call it the 'body' of the function 2012-04-18T13:00:24 you see why I cannot make much sense of it? It looks to me as if somewhere you would have to do: doPeriodic(xyzwhatever); 2012-04-18T13:00:36 and it would call into GTK+ to add a time out 2012-04-18T13:00:54 thats exactly what happens 2012-04-18T13:01:02 it would add the function xyzwhatever to be precise 2012-04-18T13:01:02 :) 2012-04-18T13:01:12 so ... I understood it? 2012-04-18T13:01:20 ofc, it is simple 2012-04-18T13:01:28 :D 2012-04-18T13:01:50 timeoutAdd registers a 10 ms interval timer in the gtk runtime, and takes an action as paraemter 2012-04-18T13:01:53 now I can go back to line 157, where I assume is that call 2012-04-18T13:02:00 that action is the sole argument of doPeriodic 2012-04-18T13:02:08 afk 2012-04-18T13:03:04 ok, it's so ... reverse to me you know. you define part of it down there and then call it further up with the argument in all its glory as a long command sequence 2012-04-18T13:03:49 e.g. to be begin with, I'm not used to *arguments* that are longer than "myCallback" or "a / 2 + 5" 2012-04-18T13:04:37 but I get it now. It's sorted in my brain. I'll buy some food now. My refrigerator is empty 2012-04-18T13:05:26 mcstar: heh, that's _really_ inefficient :P 2012-04-18T13:05:52 and it doesn't have the stuff a prefix trie is really good at (finding stuff starting with a prefix) :P 2012-04-18T13:06:07 laziness would make that really easy to do though 2012-04-18T13:06:18 the recursive searches are 3 lines of code forwards and in reverse >.< 2012-04-18T13:12:39 back 2012-04-18T13:14:38 *** choas has joined #aichallenge 2012-04-18T13:29:44 it would even be easy to do with python's generators 2012-04-18T13:29:53 at least in 3.3 2012-04-18T13:41:01 back 2012-04-18T14:01:45 *** NoxiaZ^ has quit IRC (Ping timeout: 252 seconds) 2012-04-18T14:05:14 damn regexp 2012-04-18T14:17:23 *** cyphase has joined #aichallenge 2012-04-18T14:17:32 *** choas has quit IRC (Ping timeout: 245 seconds) 2012-04-18T14:18:09 oh, look at that 2012-04-18T14:18:23 why didn't it work earlier... 2012-04-18T14:23:26 mcstar: algo exam is uploaded :) 2012-04-18T14:23:33 don't have time to do it today 2012-04-18T14:27:03 'some spies practice counter-counter-intelligence.' foiled me 2012-04-18T14:29:41 whyyyyyy 2012-04-18T14:31:46 That test-case works locally 2012-04-18T14:31:52 ponderous 2012-04-18T14:33:10 pairofdice: speed? 2012-04-18T14:37:36 *** dici has joined #aichallenge 2012-04-18T14:46:12 *** delt0r_ has quit IRC (Ping timeout: 272 seconds) 2012-04-18T14:46:23 *** thestinger has quit IRC (Quit: WeeChat 0.3.7) 2012-04-18T14:47:13 oh, stupid or 2012-04-18T14:49:11 ...# regexp does not exactly match "gamma-ray-burst" 2012-04-18T14:49:29 note-to-self: read problem description 2012-04-18T14:58:08 *** delt0r_ has joined #aichallenge 2012-04-18T15:10:35 woooo! You got it right! 2012-04-18T15:21:36 *** Accoun has quit IRC () 2012-04-18T15:25:19 i wonder if male prostitution will solve my financial problems 2012-04-18T15:25:54 Depends on your physical properties and local laws 2012-04-18T15:28:02 good points 2012-04-18T15:30:45 mcstar: when you write "let ... in ..." does the let part modify the variables before the new ship/rock is constructed or afterwards? 2012-04-18T15:32:34 *** Accoun has joined #aichallenge 2012-04-18T15:32:36 *** pairofdice has quit IRC (Quit: It is time for you to leave) 2012-04-18T15:33:00 I assume the "in" part means that the "let" part shall work on that object given there, so it would first create a new object and then check if the coordinates are outside the screen and inverse the directions 2012-04-18T15:34:23 my mother wants my ass out of the house 2012-04-18T15:35:16 mleise: let introduces bindings, like where 2012-04-18T15:35:36 the difference, is that after the in part what comes, can return a value 2012-04-18T15:35:46 so a let .. in is an expression 2012-04-18T15:35:59 where as where is a definition only 2012-04-18T15:36:14 ok, so the variables for let are new variables and you return a new object 2012-04-18T15:36:24 well 2012-04-18T15:36:36 ;return a new object' 2012-04-18T15:36:42 this doesnt make much sense here 2012-04-18T15:36:53 let just does binding 2012-04-18T15:37:23 what comes after let, is bound to the corresponding values, in all that comes after 'u' 2012-04-18T15:37:25 'in' 2012-04-18T15:37:53 like calling a function, with parameters, given values by let 2012-04-18T15:37:56 ok? 2012-04-18T15:38:02 i think this is a perfectly good analogy 2012-04-18T15:39:01 ok, let sets up some parameters passed *in* the next part of the expression which constructs a Ship/Rock which happens to be the last expression and thus the return value 2012-04-18T15:39:04 mleise: but that kind of let is a bit different 2012-04-18T15:39:19 when you are in 'do' notation, let can be alone 2012-04-18T15:39:38 when you are outside of do, let must be followed by an in 2012-04-18T15:39:53 but in a do clause, let is similar to <- 2012-04-18T15:40:01 let a = 4 2012-04-18T15:40:06 b <- someaction 2012-04-18T15:40:19 <- is another kind of binding 2012-04-18T15:40:51 it runs the action, and bind the value, that the action's return value carries 2012-04-18T15:40:56 binds* 2012-04-18T15:41:17 for example: 2012-04-18T15:41:24 action :: IO Bool 2012-04-18T15:41:29 then in : 2012-04-18T15:41:36 b <- action 2012-04-18T15:41:39 b :: Bool 2012-04-18T15:41:51 :: means type signature 2012-04-18T15:42:43 ook 2012-04-18T15:43:30 and b <- action is a binding, which means... it is not just an assignment as in C 2012-04-18T15:44:04 well, that introduces b in that scope 2012-04-18T15:44:06 i guess the language is allowed to lazily evaluate it and / or cache the return value 2012-04-18T15:44:08 there wasnt any b before 2012-04-18T15:44:35 a binding in haskell does not get evaluated multiple times 2012-04-18T15:44:45 well, in this case it does 2012-04-18T15:44:50 you do IO in action 2012-04-18T15:44:51 no 2012-04-18T15:45:12 which one do you mean? 2012-04-18T15:45:19 action :: IO Bool 2012-04-18T15:45:36 b only gets bound to something once 2012-04-18T15:45:37 doesn't that mean that your action is not pure 2012-04-18T15:46:04 well, it can have side effects 2012-04-18T15:46:20 but if you use b again, it will not get evaluted multiple times 2012-04-18T15:47:04 b here is the result of some action, ok? so you can use b, and it wont change its value 2012-04-18T15:47:43 ok, I thought binding was different from assignment 2012-04-18T15:47:44 and you really cant change b in that scope, once it is bound 2012-04-18T15:47:58 usually when I hear binding I think of something dynamic 2012-04-18T15:48:09 like a database binding 2012-04-18T15:48:13 well, there is lexical and dynamic binding 2012-04-18T15:48:21 but you dont mean in that sense 2012-04-18T15:49:08 what's a lexical binding? an alias? 2012-04-18T15:49:52 well, when you define something, and there are variables in it 2012-04-18T15:50:08 you get the values of those variables 2012-04-18T15:50:18 at the time of the definition 2012-04-18T15:50:19 so they can change, right 2012-04-18T15:50:32 and the dynamic binding isn't actually like that? 2012-04-18T15:51:01 well, when you have a dynamic variable, it means, that it can assume a value, from any scope, that has that variable 2012-04-18T15:51:24 so it will search for a scope, when it is defined(this is outside of the previous definition) and use that 2012-04-18T15:51:50 ok, so it acts like a placeholder 2012-04-18T15:52:04 yeah, but one, that does not appear in the parameter list 2012-04-18T15:52:09 it doesn't define something on its own, but uses something with the same name in the outer scopes 2012-04-18T15:52:14 yes 2012-04-18T15:52:24 opposite to this, is lexical vbinding 2012-04-18T15:52:41 *** ThomasT_ has joined #aichallenge 2012-04-18T15:53:14 *** ThomasT_ has quit IRC (Client Quit) 2012-04-18T15:54:55 i dont think you can have any kind of dynamic binding in haskell 2012-04-18T15:55:22 (but maybe there are way, im not sure) 2012-04-18T15:55:25 s 2012-04-18T15:56:02 why must all modern languages be complex :p 2012-04-18T15:56:15 what do you mean? 2012-04-18T15:56:22 this stuff is from the 50's 2012-04-18T15:56:42 including all the binding types? 2012-04-18T15:56:46 ofc 2012-04-18T15:56:54 i mean that specifically 2012-04-18T15:57:03 type theory had some advances since than 2012-04-18T15:57:06 then* 2012-04-18T15:57:26 well, im not really sure 2012-04-18T15:57:33 I think your SceneObjects would be a perfect case for OOP by the way 2012-04-18T15:57:43 for example Church founded lambda calculus in the 20's 2012-04-18T15:58:03 and there is typed lambda calculus, which might have been couple of years later 2012-04-18T15:58:19 I can't believe any of that worked without a computer 2012-04-18T15:58:20 in the late 50's there was lisp.. 2012-04-18T15:58:39 i think lisp programs were written in paper 2012-04-18T15:58:45 and sometimes executed on machines 2012-04-18T15:58:49 did they really think about vbindings in the 50s? 2012-04-18T15:59:12 or maybe in the 20s? 2012-04-18T15:59:25 well, lisp has dynamic binding, but somewhen in the 70's? they intruduced lexical 2012-04-18T15:59:38 had* 2012-04-18T15:59:39 or in the 30s? "Yeah, those new vbindings will crack the Nazi crypto algorithms" 2012-04-18T15:59:51 what is vbinding? 2012-04-18T15:59:57 you said it 2012-04-18T15:59:57 i thought it was a typo 2012-04-18T16:00:05 hahaha 2012-04-18T16:00:09 i see 2012-04-18T16:00:14 that was my typo 2012-04-18T16:00:22 lexical virtual binding 2012-04-18T16:00:32 haha, i dont know about such thing 2012-04-18T16:00:39 -virtual 2012-04-18T16:04:38 *** mleise has quit IRC (Ping timeout: 246 seconds) 2012-04-18T16:05:03 *** mleise has joined #aichallenge 2012-04-18T16:05:37 mcstar: I accidentially unlugged the power cord. I hope you didn't write much in the mean time. 2012-04-18T16:05:56 just war and peace 2012-04-18T16:06:27 :) 2012-04-18T16:07:10 hmm should I use "map" like you did or should i write imperative code 2012-04-18T16:07:56 as you prefer 2012-04-18T16:08:07 if you dont have a list, dont use map 2012-04-18T16:08:43 i dont think you want to mirror the structure of my code 2012-04-18T16:08:47 I have a list, but I wouldn't actually map the input to some other output 2012-04-18T16:08:58 just use mutation 2012-04-18T16:09:06 I want to update the objects in place 2012-04-18T16:09:09 ok 2012-04-18T16:09:34 I hava a bad feeling 2012-04-18T16:09:36 anyway, that is important, is do you know what the code does> 2012-04-18T16:09:39 ? 2012-04-18T16:09:48 what* 2012-04-18T16:10:06 you should just try to do that in idiomatic D 2012-04-18T16:10:13 Haskell would know that the content of the list is immutable and can parallelize the "map" onto all CPU cores 2012-04-18T16:10:25 no 2012-04-18T16:10:41 if not, it would be wasted potential 2012-04-18T16:10:54 that's all the fuz about FP for some folks 2012-04-18T16:10:55 why? 2012-04-18T16:11:03 it might slow the program down 2012-04-18T16:11:17 parallelization slows the program down? 2012-04-18T16:11:25 how? 2012-04-18T16:11:27 haskell doesnt want to automagically parallelize stuff for you 2012-04-18T16:11:51 ok, maybe if the list was very small the overhead to start threads would kill it 2012-04-18T16:12:05 mleise: what if the work is tiny, but the cost of distributing it, and starting and collecting the results are not? 2012-04-18T16:12:21 yes, I figured that could happen 2012-04-18T16:12:31 or, memory contention 2012-04-18T16:12:56 multiple cores, slow each other down, cause they randomly access memory blocks 2012-04-18T16:13:06 for example 2012-04-18T16:13:27 anyway, there are contructs, that let you do this kind of parallelization 2012-04-18T16:13:43 and there are libraries, that are multi-thread aware 2012-04-18T16:15:00 mleise: this is a very useful chapter from RWH http://book.realworldhaskell.org/read/profiling-and-optimization.html 2012-04-18T16:16:12 the sample problem that this chapter presents would easily surprise imperative programmer i guess 2012-04-18T16:16:17 s 2012-04-18T16:17:20 haskell is an array language? 2012-04-18T16:17:24 *** blah has joined #aichallenge 2012-04-18T16:17:37 which one mcstar, there are so many snippets and graphs 2012-04-18T16:18:18 *** blah has quit IRC (Client Quit) 2012-04-18T16:18:49 google tells me now 2012-04-18T16:18:50 no 2012-04-18T16:19:00 * rwest goes back to lurking 2012-04-18T16:20:37 rwest: ? 2012-04-18T16:20:43 rwest: good to see you 2012-04-18T16:20:51 i didnt say it was an array language 2012-04-18T16:20:56 maybe it was a bad joke 2012-04-18T16:21:03 I clicked your link and it looked like one 2012-04-18T16:21:16 from RWH? 2012-04-18T16:21:16 then I didn't get an answer right away so I googled it 2012-04-18T16:21:21 yea 2012-04-18T16:21:48 mleise: the whole chapter is good 2012-04-18T16:22:27 it just presents a simple problem, and tells you how to improve it, and how to argue about its space/time costs 2012-04-18T16:22:38 if you want to learn a language that nobody else knows, and is the ugliest language ever 2012-04-18T16:22:41 http://www.cs.washington.edu/research/zpl/zpl_guide.pdf 2012-04-18T16:22:58 I had to learn it as part of my parallel processing class 2012-04-18T16:23:14 chapel is based on zpl i think 2012-04-18T16:23:18 it is amazingly easy to create parallelized programs though 2012-04-18T16:23:38 chapel is the new initiative of cray 2012-04-18T16:23:48 it has nice syntax, but ideas from zpl 2012-04-18T16:23:54 highly influenced by zpl 2012-04-18T16:23:56 it says 2012-04-18T16:24:16 yeah, cause it has automatic parallelization 2012-04-18T16:24:24 yea 2012-04-18T16:24:25 but it is easy when all you have is arrays 2012-04-18T16:24:32 yep 2012-04-18T16:24:52 kind of limiting at times, but once you get used to it, you start to think differently about your data 2012-04-18T16:25:14 when all you have is a hammer... 2012-04-18T16:25:16 XD 2012-04-18T16:25:20 haha 2012-04-18T16:25:46 well coding in zpl was a much smaller amount of code than c w/ mpi 2012-04-18T16:25:47 heh 2012-04-18T16:25:47 in the meantime, clojure brings immutable data structures 2012-04-18T16:26:07 *** thestinger has joined #aichallenge 2012-04-18T16:26:14 every project had to be done 3 times, class was annoying 2012-04-18T16:26:29 once in c, then c with mpi, then zpl 2012-04-18T16:26:44 rwest: i dowloaded the J suite, read a tutorial, an after looking at the verb/noun/whatever dictionary of the language i decided im am not crazy 2012-04-18T16:29:41 rwest: hah, sorry, zpl is readable 2012-04-18T16:29:49 lies! 2012-04-18T16:29:51 i thought it came from the APL family 2012-04-18T16:30:20 my biggest problem with zpl was the lack of documentation 2012-04-18T16:30:39 kind of difficult to learn the language without a list of methods 2012-04-18T16:31:19 mcstar: what is "Just" for? pixmapNew (Just drawin) 600 600 Nothing 2012-04-18T16:31:44 its one of the constructors of the Maybe type 2012-04-18T16:31:47 it sure sounds funny. "Hey I'm just drawing here, ok? 600, 600, Nothing special 2012-04-18T16:32:07 ok 2012-04-18T16:32:10 mleise: C++ has it too, but it's boost::optional :P 2012-04-18T16:32:25 mleise: Maybe take a type as argument 2012-04-18T16:32:30 like: 2012-04-18T16:32:32 Maybe Int 2012-04-18T16:32:35 Maybe String 2012-04-18T16:32:45 and there are 2 constructors, Just and Nothing 2012-04-18T16:32:55 data Maybe a = Just a | Nothing 2012-04-18T16:33:22 In such cases I tend to use a pointer :p 2012-04-18T16:33:29 pointer? 2012-04-18T16:33:34 mleise: it doesn't have the overhead of a pointer 2012-04-18T16:33:38 *** kurnevsky has quit IRC (Quit: Leaving.) 2012-04-18T16:33:40 it's a tagged union (algebraic data type) 2012-04-18T16:34:02 ah those smart people 2012-04-18T16:34:03 it is an algebraic data type, that in C you would call a tagged union 2012-04-18T16:34:59 mleise: it can represent something, or the absense of that, obviosly, and it is very handy 2012-04-18T16:35:54 *** amstan has quit IRC (Quit: Konversation terminated!) 2012-04-18T16:36:10 now I am at the point where you draw to the pixmap, but I can't see if it is a cairo context appearing out of nowhere 2012-04-18T16:36:50 renderWithDrawable 2012-04-18T16:36:58 this provides everything 2012-04-18T16:37:15 well, except the pixmap 2012-04-18T16:37:38 it is provided in gtk, for cairo to be able to draw on gtk stuff 2012-04-18T16:37:48 but these are details 2012-04-18T16:38:05 i dont think you should understand the code line by line 2012-04-18T16:38:19 I'm using some class wrappers, so I miss out on that function :p 2012-04-18T16:38:56 readIORef does what? make something impure into pure copy? 2012-04-18T16:39:19 it reads the value of an IORef 2012-04-18T16:39:29 which is in the IORef monad 2012-04-18T16:39:35 but we dont need that 2012-04-18T16:40:13 as you can see, i use <- do get the value, out of the context, which is an IORef 2012-04-18T16:40:52 (i didnt mention this before, but you cant use <- outside of do, of course) 2012-04-18T16:41:04 and do, is just syntactic sugar for something more basic 2012-04-18T16:50:47 i think ill rewrite that ugly sob code 2012-04-18T16:57:32 *** dici has quit IRC (Read error: Connection reset by peer) 2012-04-18T17:01:20 *** Palmik has quit IRC () 2012-04-18T17:31:26 i go offline 2012-04-18T17:31:38 *** mleise has quit IRC (Quit: Leaving.) 2012-04-18T17:40:30 *** kilae has quit IRC (Quit: ChatZilla 0.9.88.2 [Firefox 11.0/20120312181643]) 2012-04-18T17:51:01 *** amstan has joined #aichallenge 2012-04-18T17:51:02 *** ChanServ sets mode: +o amstan 2012-04-18T18:01:25 ill make like a tree, and disappear 2012-04-18T18:01:28 *** mcstar has quit IRC (Quit: mcstar) 2012-04-18T18:23:49 *** mceier has quit IRC (Quit: leaving) 2012-04-18T18:35:47 *** iglo has quit IRC (Remote host closed the connection) 2012-04-18T18:44:44 *** amstan has quit IRC (Remote host closed the connection) 2012-04-18T18:45:04 *** amstan has joined #aichallenge 2012-04-18T18:45:04 *** ChanServ sets mode: +o amstan 2012-04-18T19:06:16 *** sigh has joined #aichallenge 2012-04-18T19:33:57 *** foRei has quit IRC (Ping timeout: 240 seconds) 2012-04-18T19:35:28 *** foRei has joined #aichallenge 2012-04-18T19:35:53 *** Alexer- has joined #aichallenge 2012-04-18T19:41:12 *** antimatroid has quit IRC (*.net *.split) 2012-04-18T19:41:13 *** Alexer has quit IRC (*.net *.split) 2012-04-18T19:41:13 *** j3camero has quit IRC (*.net *.split) 2012-04-18T19:47:55 *** antimatroid has joined #aichallenge 2012-04-18T19:52:10 *** j3camero has joined #aichallenge 2012-04-18T20:23:43 *** GarfTop has quit IRC (Quit: Make a new plan, Stan!) 2012-04-18T20:59:10 *** replore_ has joined #aichallenge 2012-04-18T21:16:05 *** foRei has quit IRC (Quit: Bye) 2012-04-18T21:39:28 *** antimatroid has quit IRC (Ping timeout: 260 seconds) 2012-04-18T22:45:28 *** delt0r_ has quit IRC (Ping timeout: 245 seconds) 2012-04-18T22:58:52 *** delt0r_ has joined #aichallenge 2012-04-18T23:57:47 *** antimatroid has joined #aichallenge