00:00:00 --- log: started haskell/02.02.05 00:12:52 --- join: shapr (~user@195.156.199.178) joined #haskell 00:15:37 --- quit: Yurik (Remote closed the connection) 00:26:19 ? 00:35:35 --- join: Vutr__ (~ss@212.169.153.139) joined #haskell 00:36:36 hi Vutr__ 00:48:00 --- join: Yurik (~yrashk@gw.telcos.net.ua) joined #haskell 00:50:31 * shapr just gave a short presentation on Joy to two of his coworkers 00:51:49 --- quit: Vutra_ (Read error: 110 (Connection timed out)) 01:00:02 shapr hi 01:00:29 hello Yurik, what's happening? 01:04:00 * shapr swears at ASN.1 01:04:19 --- nick: juhp -> juhp_ 01:04:34 hi juhp_ 01:04:43 shapr :-) 01:05:25 oh, I found a great document for the haskell-libs project: http://ocamlnet.sourceforge.net/doc/goals/goals.html 02:00:55 --- quit: xbill ("Leaving") 02:08:00 --- join: xbill (wli@DOMINIA.MIT.EDU) joined #haskell 03:23:35 --- quit: Vutr__ (Read error: 104 (Connection reset by peer)) 03:23:57 --- join: Vutr__ (~ss@212.169.153.139) joined #haskell 06:58:28 --- join: Vutra_ (~ss@port-212.169.145.131.flat4all.de) joined #haskell 07:14:16 --- quit: Vutr__ (Connection timed out) 07:14:30 * shapr sings 07:14:36 :-) 07:14:52 well, I have a possible solution for my ASN.1 decoding problem 07:21:03 hmm, ghc 5.03 snapshot. 07:21:41 yay 07:24:31 :-) 07:24:45 but anyway asn.1 is an evil tech, eh? :-) 07:25:45 truly 07:27:05 my current problem is that this open source java decoder gets confused when it runs across an IMPLICIT [0] SET OF CHOICE 07:52:22 Greetings from class! 07:52:39 hi Logan! We always knew you had class. 07:52:41 * Logan remembers learning about ASN.1 once. 07:52:49 oh whoa is me. 07:52:53 I use ASN.1 07:53:00 Heh, you love puns, huh? 07:53:11 I've only seen it used with SNMP, I think. 07:53:44 SNMP only uses a subset 07:53:52 and mostly only the OID types 07:55:19 yes, I am fond of puns. 07:55:41 It struck me as odd how SNMP, which is meant to be simple, is has something as complex as ASN.1 underlying it. 07:57:26 yup 07:57:43 my latest lesson is "don't use ASN.1, you will never be paid enough to use ASN.1" 07:57:52 I am not being paid enough to use ASN.1 07:57:57 nor is Bill Gates. 07:58:06 which class are you in? 07:58:27 Digital picture processing. 07:58:34 http://pixel.cs.vt.edu/courses/cs5814.html 07:58:35 sounds like fun 08:04:48 --- join: Luke_ (~luke@mail.bluetail.com) joined #haskell 08:05:02 what do I import to get numerator and denominator in GHC? 08:05:23 Numeric? 08:06:35 I have "import Numeric", but getting the errors: 08:06:37 Nines.hs:26: Variable not in scope: `denominator' 08:06:37 Nines.hs:26: Variable not in scope: `numerator' 08:06:44 hi Luke_ ! 08:06:49 howdy shap 08:07:06 * shapr searches for denominator 08:07:39 --- quit: kepler_ (carter.openprojects.net irc.openprojects.net) 08:07:54 Ratio? 08:07:59 that's what it looks to me 08:08:09 Luke_: are you using a Debian system with the ghc5 package installed? 08:10:52 no I just installed the rpm on redhat 08:11:16 Ratio indeed, thanks! 08:11:26 when I'm looking for a function 08:11:52 I go to /usr/lib/ghc${VERSION}/imports/ 08:11:58 --- join: kepler_ (~kepler@user-vcauhbq.dsl.mindspring.com) joined #haskell 08:12:00 and run fgrep -r functionName * 08:12:03 :) 08:13:25 it's lo-tek but effective 08:13:27 got a "Hello world" for GHC? I don't know what my 'main' function shuold be 08:13:46 main = do putStrLn "Hello world" 08:13:48 module Main where 08:13:53 main = putStr "foo" 08:14:03 I think that'll work 08:14:15 The type of main is main :: IO () 08:14:15 --- part: Vutra_ left #haskell 08:15:00 does the module have to be "Main"? 08:15:25 only if you want to compile it to an executable 08:16:03 I think 'correct' behaviour would be to write all of your code in a happy named module, then import that module into a "module Main" file and use the imported module there 08:17:00 I get a million linker errors, seems like its not linking with Prelude etc. know a fix? 08:17:12 uh, what are you trying to do? 08:17:19 just a hello world? 08:17:21 just compile a haskell program to an executable 08:17:32 no its a program that I wrote in Hugs, trying now to run in GHC 08:17:58 You specified a module name in the source? 08:18:02 oh, try doing "ghc --make -package data " + yourfilename.hs 08:18:32 the package "data" depends on several other packages, so you get them all for the cost of requesting one 08:19:05 that generates ./a.out as executable? seems to have worked, thanks 08:19:11 yay! 08:19:45 --make means to ghc "search for the modules, don't wait for me to tell you" 08:19:56 what's your program? 08:20:14 brute-force of the "Nine 9's" puzzle - have you seen it? 08:20:40 nope 08:20:48 can you give me an url? 08:20:56 Saw it in a slashdot ad. 08:21:00 oh 08:21:08 what's the puzzle? 08:21:29 it was posted on lambda.weblogs.com recently, url is: http://www.itasoftware.com/careers/programmers.php 08:24:28 cool 08:25:14 very cool 08:26:36 sounds like my next Joy problem :) 08:26:58 hey, did see I tried to compete with your erlang example on WardNumberInManyLanguages? :) 08:30:36 I think erlang beats Joy though 08:31:40 shit! that's a tiny one :) 08:32:04 the erlang one is a bit horrible I think, it started out as a normal program but became more of a disgusting "how badly can I misused list comprehensions" hack :) 08:32:12 heh! 08:32:15 sounds like fun 08:32:27 ohhh 08:32:28 I did the emacs lisp one too, which is grotesque in its own way too :) 08:32:30 I should contribute one in haskell. :P 08:32:33 that explains those guys at the bottom 08:32:43 Logan: yah, go for it! 08:32:50 Logan: you know the url? 08:33:03 the Joy one is amazingly short though 08:33:18 Joy is even more concise than Haskell 08:33:19 scary, eh? 08:33:45 jewel started working on a general purpose directed graph solver in Joy, so I'm helping with that 08:33:55 I think it'll be a replacement for my first version 08:34:23 well you are king of that wiki page... for now :) 08:34:38 heh! I look forward to your response =) 08:35:18 don't hold your breath, I'll have to try to learn a more diabolical programming language first :) 08:36:38 Like malebolge? 08:36:53 what about J or K? 08:40:41 heh, I can't understand either of the programs I put on that page :) 08:41:00 * shapr grins 08:42:29 Luke_: have you dealt with any concatenative functional langs? 08:43:01 not that I know of 08:43:14 haskell is my first excursion from vaguely lispy languages 08:44:21 hm, from the outside, erlang looks halfway between lisp and haskell 08:44:36 but then, I know most about haskell, and very little about erlang and lisp 08:45:19 Luke_: have you decided to get a book about Haskell? 08:45:50 trying to resist for now 08:46:04 erlang is somewhere between - same evaluation style as lisp etc though, but with pattern matching and list comprehensions and stuff 08:46:14 * shapr is tempted to surreptitiously send a book to Stockholm 08:46:25 no please no :) 08:46:32 * shapr laughs 08:46:39 actually I plan to borrow one of someone at work but again, resisting :) 08:47:52 I would like to replace bash with some funky one-liner language though 08:48:06 I think shell scripting would be a great application of some of that scary joy stuff :) 08:48:12 I agree! 08:48:54 sounds like the beginning of a fun project :) what's a good starting point? 08:49:13 with Joy? 08:49:27 hang on, forget I said that :) I must refrain 08:49:40 heh, ok 08:50:07 tell me when you have time, I'm exploding with enthusiasm for Joy at the moment 08:50:23 oh hey, did I already ask you what you thought about spoken programming? 08:50:47 urf, I gotta home 08:50:59 I'll be back online when I get home 08:51:08 --- quit: shapr ("time to go home") 09:10:42 --- quit: Yurik ("bye") 09:30:25 --- join: shapr (~user@p-c2fbab34.easy.inet.fi) joined #haskell 09:32:46 * shapr returns 09:39:25 choices choices... 09:40:18 do I code more Joy 09:40:25 do I finish my Loty homework 09:40:35 do I play tribes2 ... 09:42:36 or I could 09:42:39 set up a personal wiki 09:42:49 or hack up a joy-mode 10:05:39 --- join: tmoertel (~chatzilla@pa-mtlebanon2a-268.pit.adelphia.net) joined #haskell 10:08:18 hi tmoertel, what's up? 10:35:45 * Logan is going to finish these programming contest problems. 10:35:52 Two to go, and I've already solved one entirely in my head. 10:36:07 * shapr is discussing gnome screen-readers with a blind programmer 10:36:19 that programmer wrote most of my irc client as well ;) 10:36:52 Logan: how do you test the head-solved one? 10:38:50 Head-solved one? 10:41:23 the one that you solved in your head - which was that? 10:41:32 Oh. 10:41:43 http://www.ntnu.edu.tw/acm/ProblemSetArchive/A_FINALS/1996/Finals96html/ftrellis.html 10:41:52 I have the code for it in my head. :P 10:42:23 no comment. :) but sorry, different problems than I was thinking of 10:50:34 anyone know what the space complexity of haskell's sort function is? 10:56:25 I take it !! is left-associative? 10:56:33 It isn't guaranteed 10:56:50 Oh? 10:57:00 The associativity is undefined? 10:57:06 The space complexity 10:57:09 Oh. 10:57:22 But !! is left-associative? :P 10:57:35 I guess I could find out in a number of ways. 10:57:47 is there a more efficient way to write a large daat strcuture to a file than using 'show' + putStr and redirecting output in the unix shell? 10:58:01 I can't remember where the table of them is 10:58:36 Using writeFile would be nicer 11:00:22 where can I find a hashtable? 11:08:02 This might be the most elegant haskell program I've written yet. 11:08:06 Too bad it doesn't work. :P 11:09:19 It doesn't even make sense why it's not working. 11:09:29 I have a function that is not supposed to ever receive a string of less than 2 characters in length... 11:09:34 And it only gets called by one other function. 11:09:50 So in the calling function, I checked for the pattern xs@(x:[]), and had it do an error if it sees it... 11:09:55 And in the function it calls I did the same thing. 11:10:05 I get the error in the function that gets called, but not in the calling function. 11:10:33 And function programs are supposed to be easier to reason about, goddamnit. :P 11:16:53 Oh, nevermind, I'm an idiot, as you might have expected. :P 11:25:41 * Logan scratches his head on this type error... 11:25:42 transform :: [String] -> [String] 11:25:42 transform [] = [] 11:25:42 transform (x:xs) 11:25:42 = 11:25:44 map (\z -> map (z:) y) x 11:25:47 where 11:25:49 y = transform xs 11:26:07 Couldn't match `Char' against `[t]' 11:26:22 Why does it think z is [t] rather than Char? 11:27:45 what do you have as argument ? 11:28:07 The function takes a list of strings. 11:28:10 err, wait 11:30:07 The type of map (\z -> map (z:) y) x is [[String]] 11:31:14 Hmm... \z -> map (z:) y should be [String]... 11:31:18 Ok, I sorta see. 11:31:27 * Logan rethinks how to formulate what he wants. 11:31:59 \z -> map (z:) y is Char -> [String] 11:32:21 And map is (a -> b) -> [a] -> [b] so b is [String] so [b] is [[String]] 11:32:22 For each character in x, for each string in y, I want to prefix that character to the string, and return all the strings composed that way in a list. 11:32:33 * Igloo is about to leave 11:32:57 I think I can figure it out from the verbal description I just gave. 11:33:16 I want the x on the inside and y on the outside. 11:33:30 List comprehensions might be what you want 11:34:13 I suck at those. :P 11:34:18 I should try, just to learn. 11:35:40 I guess list comprehensions represent the "foreach" concept pretty well? :P 11:37:23 try [(xc:ys) | xc <- x, ys <- transform xs] 11:37:41 Yeah, that's the first thing I tried. :P 11:37:52 And it worked, jsut didn't realize my definition for the base case of my function was wrong. 11:38:32 Awesome, my program now works! 11:38:36 Thanks for the help. 11:57:42 FiniteMap Rational [Operator] - lot of typing, can I give that a shorter name somehow? 11:57:59 type X = FiniteMap Rational [Operator] 11:58:01 thanks 11:58:30 type introduces a type synonym, newtype I think does the same but makes the synonyms incompatible with each other. 12:23:20 what's a finitemap? 12:25:05 associative array, like a hashtable (but in GHC its a balanced tree I think) 12:26:47 do they have O(1) hashtables in Haskell? 12:27:12 dunno. would guess these are O(log2(n)) 12:31:47 does haskell have a "flatmap"? (like map, but function returns lists, which get appended) 12:35:14 I'm not sure what you mean... can you give me an example input and output? 12:36:22 (flatmap (\x -> [x,x]) [1,2,3]) => [1,1,2,2,3,3] 12:36:36 easy enogh to write, just want to kill mine if its already in prelude 12:53:30 Oh, you want to concatenate a list of lists? 13:14:02 cross between that and map 13:14:58 Maybe some sort of fold? 13:16:16 foldr (\x y -> [x, x] ++ y) [] [1, 2, 3] 13:16:58 I have the definition: 13:17:01 flatmap f [] = [] 13:17:01 flatmap f (hd:tl) = (f hd) ++ (flatmap f tl) 13:17:12 but just wonder if there is already a function that does the same thing, by a different name 13:17:29 foldr. :P 13:17:52 not as convenient :) 13:18:15 foldr (++) [] $ map (\x -> [x,x]) [1, 2, 3] 13:18:34 flatmap f g = foldr f [] $ map g 13:18:44 Or flatmap f g x = foldr f [] $ map g x 13:19:20 flatmap (++) (\x -> [x, x]) [1, 2, 3] 13:19:45 do those all work? 13:20:55 Yes. 13:21:24 The reason I specified flatmap as taking two functions is you may want the second function be something besides [a] -> [a] 13:21:42 But then it's not really a flatmap unless you're doing (++) and a [a] -> [a] function, I guess. :P 13:21:56 So maybe you should just call it flatmap f x = foldr (++) [] $ map f x 13:22:26 Or, foldrmap f g x = foldr f [] $ map g x, flatmap = foldrmap (++) 13:22:35 That seems a better design. 13:24:14 Logan> let foldrmap f g x = foldr f [] $ map g x; flatmap = foldrmap (++) 13:24:15 Logan> flatmap (\x->[x,x]) [1,2,3] 13:24:15 [1,1,2,2,3,3] 13:24:22 :P 13:25:02 Logan> flatmap (replicate 2) [1,2,3] 13:25:02 [1,1,2,2,3,3] 13:25:09 flatmap = (concat.).map 13:25:11 Even better. :P 13:25:16 Ah, concat. 13:25:19 I forgot about that. 13:25:53 I've never made a (f.).g construct. :P 13:35:09 Is there a haskell library that provides priority queues? 13:37:25 Logan: can't you just use a finite map? 13:45:34 To implement a priority queue? 14:52:50 --- quit: shapr (Remote closed the connection) 15:05:50 --- join: shapr (~user@p-c2fbab34.easy.inet.fi) joined #haskell 15:06:54 Where was that Ward number Wiki thing? :P 15:07:53 http://c2.com/cgi/wiki?WardNumberInManyProgrammingLanguages 15:08:09 Thanks. 15:08:15 how do I do trace output again? 15:08:40 trace function? 15:09:56 found it again 15:10:09 What's the fu nction to turn a 2-tuple into a list? 15:10:24 * shapr dunno that one 15:10:31 I saw it the other day, but forgot it. 15:11:41 Or maybe I didn't. 15:11:50 (\(a,b) -> [a,b]) 15:12:05 * shapr tries to create a simple joy-mode in emacs 15:17:21 Heffalump: Yes, I love lambda functions, always there to fall back on when I can't remember the functions. 15:17:33 But when there's a defined function for something, it seems ugly to me to use a lambda abstraction. :P 15:19:25 for something that short, it hardly matters 15:26:03 * Logan nods. 15:26:15 I just find it easier to read when there's a symbolic name for a common operation. 15:26:28 I can't think of anything or spot anything in the prelude 15:27:20 * Logan nods. 15:27:23 I was thinking of fst and snd. 15:27:27 But they don't do that. :P 15:27:46 no :-) 15:28:42 I seem to recall a function somewhere to partition a list? 15:28:51 partition? 15:28:57 I can do that with a list comprehension, I'm sure. 15:29:15 hm, I know it's in there 15:29:18 I don't remember the name though 15:29:24 [ (x, y) | x <- filter p list, y <- filter (not.p) list ] 15:29:48 Yeah, I think it's in List. 15:29:58 Called partition. :P 15:30:02 Though I remembered seeing something like that. 15:30:25 You mean (filter p list, filter (not.p) list) 15:31:40 Hey, that works too. :P 15:32:46 Hmm, there's a List.transpose, I didn't need to write my own yesterday. :P 16:15:17 --- quit: kepler_ (carter.openprojects.net irc.openprojects.net) 16:17:50 Cool, I think my Ward number program works. :P 16:18:52 hmmm 16:19:06 * yusri beats his head against Haskell's types just one more time 16:19:32 Logan: cool! post it! 16:20:12 shapr: I'm not sure if it's correct. It works for the sample case you included in your submission. :P 16:20:18 pity that ward numbering is such a generally sad activity, but who can resist a hack :) 16:20:34 Luke_: come up with a better one :) 16:20:42 the idea was to make something that's one step above hello world 16:20:54 yeah its good clean fun :) 16:21:03 Ward> let a = [("ward", "al"), ("al", "shae"), ("ward", "mike"), ("al", "joe")] 16:21:03 Ward> xNumber "ward" a 16:21:03 [("joe",Just 2),("shae",Just 2),("ward",Just 2),("mike",Just 1),("al",Just 1)] 16:21:26 I think coding a breadth-first search is a great exercise for learning a language. :P 16:21:30 Real Men parse their input from a file with two space-separated names per line. :) 16:21:43 (but common to skip that in wimpy languages ;-)) 16:21:50 Luke_: ok ok, I'll add that feature in version 2 :) 16:24:53 I should really learn monads 16:25:03 I need some type of data persistence before I go crazy 16:25:10 tribes of monadic grad students harry the campus 16:25:21 Luke_: txt <- getContents; let graph = map (\x -> case words x of { [a, b] -> (a, b) }) $ lines txt in { ... } :P 16:25:33 shapr, ever eccentric ;) 16:25:45 who, me? 16:26:14 nice 16:26:18 Luke_: what time do you have to show up at work in the mornings? 16:26:18 ha! I've read your webpage, buddy 16:26:23 uh oh 16:26:26 * shapr hides 16:27:47 * yusri mutters something about 'haskell berbisa,' then goes back to his indonesian language parser 16:28:45 shapr: mornings? I got in abuot 3pm today :) 16:29:02 ah, no wonder you are able to stay awake longer than I 16:29:09 my boss wants me at work by 9am 16:29:23 I even made it in that early once 16:29:37 * yusri generally goes to work at 10pm 16:29:43 So I win ;) 16:29:43 yah me too 16:29:47 bah 16:29:47 shapr: where're you working? 16:29:50 widian.fi 16:30:02 but the rules clearly state I should be at work by 9am 16:30:26 well it is nice for people to be in at around the same time, I just got carried away with some hacks ont he weekend and ruined my timezone 16:31:22 I think I would make it in by 9am if we actually did pair programming at work 16:31:28 I'd enjoy programming with someone else 16:33:48 we've been doing a fair bit of pair programming recently, it is an interesting change 16:35:40 I wish I could persuade people to pair with me 16:39:00 * shapr goes to sleep 16:45:42 shapr: I posted my haskell implementation. :P 16:45:43 --- quit: shapr (Remote closed the connection) 16:45:48 Haha. 17:49:46 --- quit: jemfinch (Remote closed the connection) 18:18:44 --- join: Lunar_fr (~lunar@cha213245071119.chello.fr) joined #haskell 18:18:54 Hi 18:20:24 Is there anyone ? 18:27:31 --- quit: Luke_ (Remote closed the connection) 18:27:33 --- join: Luke_ (~luke@mail.bluetail.com) joined #haskell 18:28:42 Is there anyone ? 18:28:57 Yes, there is. 18:29:19 :) 18:29:55 I'm having problem compiling ghc 18:31:53 make[2]: *** No rule to make target `Addr.o', needed by `libHSlang.a'. Stop. 19:01:39 --- quit: Lunar_fr (Remote closed the connection) 20:33:36 You can learn a lot just by reading the standard prelude. 21:21:45 --- quit: tmoertel ("switching hosts . . .") 21:23:37 --- join: tmoertel (~chatzilla@icubed-20-15.dslrt.icubed.com) joined #haskell 21:44:50 --- quit: tmoertel (Excess Flood) 21:56:30 --- join: tmoertel (~chatzilla@icubed-20-15.dslrt.icubed.com) joined #haskell 22:01:08 --- quit: tmoertel (Client Quit) 22:04:54 --- join: jemfinch (~jemfinch@rnie-99-43.resnet.ohio-state.edu) joined #haskell 22:05:29 --- quit: jemfinch (Client Quit) 22:06:21 --- join: jemfinch (~jemfinch@rnie-99-43.resnet.ohio-state.edu) joined #haskell 23:59:59 --- log: ended haskell/02.02.05