00:00:00 --- log: started haskell/02.03.03 00:19:33 --- quit: v_2 ("Client Exiting") 02:09:52 --- join: dennis_ (~dennis@as2-4-3.an.g.bonet.se) joined #haskell 02:09:52 --- quit: dennisb (Read error: 104 (Connection reset by peer)) 02:10:12 --- nick: dennis_ -> dennisb 02:38:33 --- join: shapr (~user@p-c2fbabf7.easy.inet.fi) joined #haskell 02:41:33 --- quit: clausen ("send all money to /dev/clausen") 03:31:54 --- join: ChoJin (~ask@cha213245038031.chello.fr) joined #haskell 03:57:54 --- join: Continuum (~continuum@CPE-144-137-134-146.qld.bigpond.net.au) joined #haskell 03:57:58 --- quit: jao (Read error: 104 (Connection reset by peer)) 03:58:20 hi all 03:58:32 hi Continuum 03:58:37 what's up? 03:59:06 well i'm just about to start learning haskell so i thought i'd drop in 03:59:20 you should also check out #loty then 03:59:36 ok whats that ?? 03:59:49 I'd recommend purchasing "Haskell : The Craft of Functional Programming" by Thompson 04:00:12 yeah i think thats the prescribed text for my uni course 04:00:40 it's the best book I've found yet for learning Haskell. 04:00:49 the Hudak book is pretty spiffy 04:01:02 but not as good for learning in my experience 04:01:07 so you know a bit about it then :) 04:01:13 yah, some. 04:01:30 I'm still a beginner really, but I've spent some time learning and written some code. 04:01:42 :) ok well if i have a couple of small questions, can u answer them 4 me ? 04:01:49 as much as I can, I will 04:01:52 :) 04:02:28 well u see i've done heaps of procedural programming but this is all kinda a mess to me.... 04:02:57 yah, functional programming is really different 04:02:58 i think i need to learn how to think haskell before i can program in ti 04:03:03 it 04:03:17 I had to try to program in it before I could learn to think in it 04:03:35 :) 04:03:51 whats the general way to do if statements? or do things not work like that in haskell 04:04:02 sometime it takes 6h to write 8lines at the beginning :) 04:04:18 yah, my first ten lines of Haskell took me several days 04:04:23 ie. if x > y do blah else do blah 04:04:25 'if' is not used a lot in haskell 04:04:26 but after that it got easier fast 04:04:43 well i wrote a permutations code in like 3 min 04:04:48 I prefer to use '|' when I can 04:04:49 but that was easy 04:04:56 hows that work ?? 04:05:02 i'm kinda confused 04:05:10 max a b | a >= b = a 04:05:14 for instance :) 04:05:22 read | as 'such as' 04:05:23 ah ok i can do it now :) 04:05:28 like in math 04:05:28 :) 04:05:33 lol 04:05:33 Continuum: http://kungens.kemi.fi/~shae/Mandelbrot-0.2.hs 04:05:58 I'd suggest reading the tutorials you can find online if you don't have the Thompson book yet 04:06:09 if you already have the book, it's by far the best place to start. 04:06:22 ok 04:06:23 :) 04:06:31 i'll buy it tomorrow :) 04:07:35 well i tried to follow the online intro to haskell at www.haskell.org 04:07:35 we bought this book for our library "Algorithms: A functional programming approach", dunno yet if it is good :) 04:07:49 read the gentle introduction to haskell :) 04:07:51 but i got confused 04:07:55 ChoJin: I've heard it's good, but I've not seen it myself 04:07:56 i did 04:08:13 I read another paper about monad which was good 04:08:21 let me look if I can find it 04:08:41 ok well the gentle intro is at the haskell home site 04:08:53 I think I understand monads, but I really don't know how to creatively use them. 04:08:55 but i think it's a little to gentle 04:09:03 I thought it was too hard :) 04:09:08 or not gentle enough 04:09:16 was being sarcastic 04:09:18 :) 04:09:27 oh ok :) 04:09:28 whew 04:09:30 so did i shapr 04:09:45 thats why i'm here now 04:09:54 there is a new tutorial in the works 04:10:15 but so far, the thompson book is still the best intro 04:11:01 btw I read this "* Structuring Depth First Search Algorithms in Haskell" 04:11:06 it was interesting 04:11:11 you have an url? 04:12:07 that's not exactly a tutorial paper 04:12:12 ChoJin - Could write it in C or ASM but no way in haskell!!!!!!!!!!!!!1 04:12:22 hi Heffalump! 04:12:24 ftp://ftp.dcs.glasgow.ac.uk/pub/glasgow-fp/papers/essence-of-fp.ps.Z 04:12:28 ltns! 04:12:29 http://www.dcs.gla.ac.uk/fp/authors/David_King/structuring-dfs.ps.gz 04:12:35 oops, too slow :-) 04:12:41 read this, its about monad 04:12:44 * shapr is spending too much time doing work that pays 04:12:50 hi Heffalump 04:12:51 * Heffalump too 04:12:55 oops. 04:13:00 s/Heffalump/shapr/ 04:13:05 lol 04:13:05 * Heffalump unconfuses himself 04:13:07 heh :) 04:13:09 hi Igloo! 04:13:09 shapr.... thanks for the help :) ( max a b | a >= b = a ) got my code to work now 04:13:11 ltns too! 04:13:12 and for graph: http://www.cse.ogi.edu/~jl/biblio-functional.html 04:13:24 no, I've definitely seen myself recently 04:13:32 Hi :-) 04:13:36 hi 04:13:37 :) 04:13:42 You want to see something really sad? This is how my university attempts to teach functional programming: 04:13:43 http://courses.cs.vt.edu/~cs5314/Spring02/programs/prisoner-2P.scm 04:13:50 hi Logan! 04:13:54 wow, this is great, lots of activity :) 04:14:16 Just looking at "Part I" is enough to make you shake your head in disbelief. 04:14:38 I'm not sure if the professor wrote it or his TA. 04:14:42 back in a sec 04:14:45 --- quit: Continuum () 04:16:09 --- join: Continuum (~continuum@CPE-144-137-134-146.qld.bigpond.net.au) joined #haskell 04:17:41 hey again 04:17:52 y0 04:19:03 I'm seriously considering submitting a strong critique of the choice of scheme as representative of functional programming. 04:19:40 before I knew haskell, I thought scheme was all about FP 04:23:36 Scheme seems to really hinder FP. 04:23:43 lol 04:23:57 It's like using Fortran to teach people imperative programming. 04:24:02 Sure, you can do it, but why? 04:29:24 lol 04:30:27 It's like teaching OOP with javascript. 04:30:32 Oh well, good night. 04:31:32 g'night Logan! 04:31:40 * shapr wanders off to do Zope stuff to get more money 04:32:08 --- join: jao (jao@62-36-160-234.dialup.uni2.es) joined #haskell 04:43:34 --- join: nodie (~nodie@213-99-73-83.uc.nombres.ttd.es) joined #haskell 04:45:59 wow, lotsa people around 04:46:12 hi shapr 04:47:01 hi nodie, what's up? 04:47:33 :) 04:47:46 implementing things with haskell 04:48:15 my friends call me fool because i'm implementing CGI with haskell 04:48:41 i saw that libraries are badly documented :-( 04:49:56 it's hard to implement interesting things 04:50:20 I don't think it's foolish to implement anything. 04:51:00 if it improves your personal learning, or it serves a useful purpose, then I think it's worthwhile. 04:52:36 i see that people implements programs and does'nt look a good design for futures updates or revisions 04:52:44 though others have already implemented CGI with Haskell 05:06:58 * shapr sighs 05:07:10 sometimes I wish I could use Haskell from inside Python/Zope 05:25:33 --- quit: jao (Read error: 113 (No route to host)) 05:27:13 bye 05:27:13 --- quit: nodie ("using sirc version 2.211+KSIRC/1.1") 05:27:49 --- join: jao (jao@62-37-170-11.dialup.uni2.es) joined #haskell 05:43:04 --- quit: Continuum () 06:38:20 --- quit: dennisb (Read error: 113 (No route to host)) 06:52:01 --- join: dennisb (~dennis@as2-4-3.an.g.bonet.se) joined #haskell 07:31:34 --- quit: shapr (carter.openprojects.net irc.openprojects.net) 07:31:59 --- join: shapr (~user@p-c2fbabf7.easy.inet.fi) joined #haskell 08:19:16 --- quit: xbill ("Leaving") 08:46:29 --- join: kepler (~kepler@user-vcaugd9.dsl.mindspring.com) joined #haskell 10:23:33 --- quit: jemfinch` (Success) 10:36:47 --- join: xbill (wli@DOMINIA.MIT.EDU) joined #haskell 11:38:16 --- join: arete (arete@greenland.spottedfly.com) joined #haskell 11:40:00 hello, I'm having some trouble with hugs crashing when I try to run some code from the hudak book... specifically translating coordinates 11:40:18 anyone had similar probs? 12:02:19 no, hugs is usually stable 12:03:22 arete: i have not read that book, what kind of examples? window programs where you draw things in windows? 12:03:36 yeah 12:03:53 but I suspect my problem is some type issue 12:04:01 because the problem code is just some simple conversion routines 12:04:25 well, if hugs crashes because of some type problems it is a bug in hugs 12:04:56 all I get is "Illegal instruction", then the process dies 12:04:58 are the functions small? 12:05:17 however nhc98 gives me a different error and the compiled app dies 12:05:20 yeah very simple 12:05:42 then show it! 12:05:53 ok 12:05:55 inchToPixel :: Float -> Int 12:05:56 inchToPixel x = round (100 * x) 12:06:16 trans :: Vertex -> Point 12:06:16 trans (x, y) = (xWin2 + inchToPixel x, yWin2 - inchToPixel y) 12:06:27 is that crashing?? 12:06:32 yeah 12:07:02 xWin2 and yWin2 are Ints derived from other Ints 1div1 2 12:07:06 er `div` 12:07:20 very, very strange 12:07:52 yeah =/ 12:10:35 guess I should see if it runs on win32... this is macos X 12:10:41 sounds like you have a broken installation.. 12:11:24 it has worked fine so far though 12:11:47 there is nothing here that can fail, I pasted it in hugs that I have (linux) and it seems to work fine 12:11:54 ahh hmm 12:12:25 (I had to add some lines for Point and so on) 12:12:32 *nod* 12:13:16 but on the other hand, i've seen hundreds of programs like this and never seen it fail. I think there is some other problem that you have 12:14:19 if it uses macos X to open windows and doing graphical stuff, then maybe there is some bug there that corrupts the memory and causes it to crash later, or something 12:14:42 yeah but I've isolated this code in its own module and it still crashes 12:14:52 no graphics stuff at all, and no imports 12:15:02 fun 12:15:12 I could try it if you want 12:15:24 but i'm sure it will work here :-) 12:15:27 hehe 12:15:32 probably, think there is a law about that 12:16:38 can I dcc it to you? 12:16:44 sure 12:18:35 it crashes winhugs too 12:18:42 I see the bug 12:19:00 xWin2 = xWin2 `div` 2 12:19:13 ack 12:19:26 this is a recursive definition, to calculate xWin2 you need the value of xWin2, and so on 12:19:43 ugh, right you are 12:19:52 now that is a dumb error 12:20:06 * arete raps his knuckles 12:20:21 well thanks! 12:20:23 it runs fine now 12:20:41 to much imperative programming 12:21:06 yeah, this is my first foray into fp 12:24:01 arete: well, it 12:24:47 it works now at least! 12:24:54 yeah I'mm happy =) 12:24:57 can continue 12:25:12 I spent several days trying to figure out why it wouldn't work 12:25:23 now I have lots of pretty shapes being drawn on the screen 12:25:39 yes, it takes time to debug when you work with a language you don't know that much 12:26:12 control stack overflow is usually caused by some recursive definition 12:26:38 badly defined recursive definition I should say 12:26:49 yeah, I might have been able to figure out the problem if I knew it was a stack overflow 12:27:02 Didn't hugs say so? 12:27:11 nope, just crashed with "Illegal instruction" 12:27:17 what does yours say? 12:27:30 Main> main 12:27:30 ( 12:27:30 ERROR - Control stack overflow 12:28:14 it printed the ( and then when it was going to calculate the number it overflowed the control stack 12:28:21 hmm yeah 12:28:28 it's lazy so it printed the ( first 12:28:28 I get the ( too, shoulda been a clue 12:29:06 if I compile it I get: 12:29:10 $ ./a.out 12:29:10 Fail: <> 12:29:39 No ( this time, I guess the compiler optimized it in some way 12:30:09 Illegal instruction sounds bad 12:30:22 i get Black hole detected in eval ZAP! 12:30:30 from nhc, ghc doesnt' compile on os x 12:30:54 yes, black hole is the same thing 12:31:12 means infinite loop? 12:31:20 I don't know where that comes from, but it's a usual name for it 12:31:24 yes 12:31:28 ahh, thats good to know 12:31:35 its a nice error message, but didn't tell me much =) 12:32:26 it's not exactly like infinite loop, but some cases it can detect and print an error message for 12:32:48 *nod* 12:33:05 you can also write functions that are looping for ever and not get a black hole error 12:33:10 (of course) 12:34:01 well, got to go. you are on your own again, bye 12:34:01 does it not overflow the stack in that case? 12:34:06 no 12:34:09 ahh ok, well thanks for the help! 12:34:15 it is detected before 12:34:32 ahh I see 12:35:54 or do you mean if you write a function that are looping? 12:36:08 you can write tail recursive functions that does not use any stack 12:36:25 well, now I really have to go :-) 12:36:31 hehe bye, thanks for the save 12:39:31 --- quit: shapr (Read error: 110 (Connection timed out)) 13:07:12 --- join: clausen (~andrew@c17997.eburwd3.vic.optusnet.com.au) joined #haskell 14:05:48 --- quit: kepler (Read error: 104 (Connection reset by peer)) 14:07:26 --- join: kepler (~kepler@user-1120o8g.dsl.mindspring.com) joined #haskell 15:29:29 --- quit: smkl (Remote closed the connection) 15:30:00 --- join: smkl (~sami@glubimox.yok.utu.fi) joined #haskell 15:32:34 --- join: pesco (~pesco@pD9500AB8.dip.t-dialin.net) joined #haskell 15:34:48 I'm trying to implement a CRC in Haskell. Char has 16 bits. readFile returns a List of Chars. Do those include two bytes of the File at a time? 15:35:19 no 15:35:29 Good, thought so, just to make sure. 15:35:53 Now all I need is an XOR function. There is none in the Prelude? 15:35:58 If you're really paranoid about it, you could maybe use IOExts, but at least on my computer with ghc, IO has been observed to be a byte at a time, I think. 15:36:30 Anything else wouldn't make sense, because the file might well be of odd length. 15:37:10 Odd length of what? 15:37:16 bytes 15:37:18 That presupposes bytes as a unit. :P 15:37:30 Yes. It does. 15:37:45 An odd-length of 16-bit characters would pose no problem for wide character input. 15:38:23 But you do agree that binary data does not usually adhere to such alignments? 15:38:37 Yes. 15:38:53 Now, what about that XOR? 15:39:15 Or am I supposed to convert the bytes to [Bool]? ;^) 15:40:13 http://google.com/search?hl=en&q=haskell+xor 15:40:28 :) Thanks. 15:44:11 --- quit: ChoJin ("bye !!!") 16:49:34 --- quit: smkl (Remote closed the connection) 16:50:15 --- join: smkl (~sami@glubimox.yok.utu.fi) joined #haskell 17:43:52 --- quit: pesco (Remote closed the connection) 18:47:34 --- join: malc (~clamky@nat-kh0.nat.comex.ru) joined #haskell 18:47:59 anyone alive? 18:58:10 see http://www.iaa.wide.ad.jp/ 18:58:14 ;) 18:59:36 heh 19:00:51 anyhow i just wanted to ask how would flipsum be implemented in haskell (i.e. \sum_{i=0}^n(-1)^{i}...) 19:03:38 i guess you can first set up an infinite alternating list 19:03:57 then you can just "take" the required number 19:04:05 my first version was 19:04:09 and "sum" that 19:04:18 a = 1:(-1):a 19:04:30 sum (zipWith (*) list a) 19:04:47 but somehow that restricts type of list to natural numbers and i dont like it 19:05:12 does it give the right answer? 19:05:18 sure it does 19:05:29 but it wont work on say Church numerals 19:05:35 do you really need "(*)"? 19:05:49 s/need/mean/ 19:06:05 yes i really mean (*) 19:06:47 wait a minute 19:06:50 Prelude> let sinf = 1:(-1):sinf 19:06:50 Prelude> sum (zipWith (*) [1,2,3] sinf) 19:06:50 2 19:08:07 hmmm, guess i am not sure what you mean by flipsum :) 19:08:33 what's "..."? 19:08:49 a-b+c-d+e... 19:09:04 ... in the context means addend 19:09:15 ah, gotcha 19:10:24 have you given a type signature for your function? 19:11:37 Num a=>[a]->a 19:12:22 but that implies they have the same type 19:12:47 no 19:13:30 Prelude> :t sum 19:13:31 forall a. (Num a) => [a] -> a 19:13:44 flipsum is the same in this respect 19:17:19 Prelude> :type flipsum 19:17:21 [Integer] -> Integer 19:17:35 in ghci 19:18:16 let flipsum as = sum $ zipWith (*) alt as where alt = 1: -1: alt 19:19:52 Prelude> let flipsum as = sum $ zipWith (*) alt as where alt = 1: -1: alt 19:19:52 Prelude> :t flipsum 19:19:52 forall a. (Num a) => [a] -> a 19:20:03 ghci 19:20:44 but this is irrelevant, as i said this version works(and it was the first out of 3 i have implemented), but i dont like it 19:21:12 what's wrong with it? 19:21:55 it needs negative numbers 19:22:37 ? 19:23:28 suppose i have instance of Num for natural numbers. flipsum wont work here. (because of -1) 19:24:29 --- quit: xbill ("Leaving") 19:26:31 but that doesn't seem possible since you can't define (-) on Nat 19:26:41 why is that?? 19:27:00 --- join: graylensman (~ray@fl-wbu2c6-167.pbc.adelphia.net) joined #haskell 19:27:12 so what is 1-2 then? :) 19:27:27 that doesnt mean that 2-1 doesnt exist, now doesnt it? ;) 19:28:07 well, you can give a complete instance for (-) in this case, can you? 19:28:19 correct 19:28:44 --- join: kepler_ (~kepler@user-vcauh4a.dsl.mindspring.com) joined #haskell 19:28:49 but Float doesnt have complete instance of sqrt, this doesnt seem to stop anyone 19:29:22 mmmh, you have a point 19:31:14 thats why (as a newbie in Haskell) i want to know what would be a haskellish way to define flipsum under this constraint 19:31:32 well can't you define somwthing like 19:32:21 fromNat :: Num a => Nat -> a 19:32:52 say i cant 19:33:08 but then that breaks polymorphism, right 19:33:50 im sorry? 19:34:34 i just mean dropping something like fromNat in your function, would break polymorphism 19:34:56 ie restrict flipsum :: [Nat] -> Nat 19:35:02 if it were defined 19:35:34 right. thats what i actually want 19:36:18 but (*) -1 is not well-defined on Nat either! 19:36:50 ofcourse 19:37:29 there needs to be some severe restricts on the list of numbers for the problem to be meaningful i would say 19:39:21 this will get us nowhere, apparently you just hiding the true haskellish way from me. oh well 19:39:29 --- quit: malc ("no reason") 19:42:59 --- quit: kepler (Read error: 110 (Connection timed out)) 19:44:59 probably ;) 19:45:49 but i'm just trying to say that flipsum is not well-defined for most Nat lists 19:49:23 of course if you want [Nat] -> Integer thne that's a different story 19:49:32 s/thne/then/ 19:50:54 --- quit: graylensman (Remote closed the connection) 20:00:37 --- quit: Jiriki (Read error: 104 (Connection reset by peer)) 20:03:05 --- quit: smkl (Read error: 104 (Connection reset by peer)) 20:03:20 --- join: smkl (~sami@glubimox.yok.utu.fi) joined #haskell 20:07:05 --- join: Jiriki (sjh@Sprint223.tbaytel.net) joined #haskell 22:06:12 --- join: dennis_ (~dennis@as2-4-3.an.g.bonet.se) joined #haskell 22:06:13 --- quit: dennisb (Read error: 104 (Connection reset by peer)) 22:06:20 --- nick: dennis_ -> dennisb 22:25:58 --- join: jao_ (jao@62.37.171.197) joined #haskell 22:25:58 --- quit: jao (Read error: 104 (Connection reset by peer)) 22:33:22 --- quit: jlb (Remote closed the connection) 23:16:44 --- join: jlb (~ktk@jeremeydsl-3.mylinuxisp.com) joined #haskell 23:34:49 --- quit: jao_ (Read error: 113 (No route to host)) 23:59:59 --- log: ended haskell/02.03.03