00:00:00 --- log: started haskell/02.02.07 01:32:40 --- join: shapr (~user@p-c2fbab85.easy.inet.fi) joined #haskell 01:36:14 --- quit: jemfinch (Read error: 104 (Connection reset by peer)) 01:37:38 --- join: jemfinch (~jemfinch@rnie-99-168.resnet.ohio-state.edu) joined #haskell 01:49:44 --- quit: juhp (Read error: 110 (Connection timed out)) 02:17:29 --- join: ChoJin (~ask@cha213245038031.chello.fr) joined #haskell 02:17:30 hi 02:17:41 hi ChoJin 02:17:43 what's up? 02:18:01 type Neuron = ({weightFct :: WeightFct}, SumFct) 02:18:04 what is wrong ? 02:18:15 it says parse error with { 02:18:33 what should the { do? 02:18:39 I've not seen that before 02:18:48 I want to give name to field of the tuple 02:19:03 it should automatically generate function to access to this field 02:19:23 like: weightFct n will be like fst n 02:19:23 * shapr has never used that 02:19:28 I don't know, sorry :( 02:19:33 I read this in the Gentle to haskell 02:19:35 that looks like incorrect records syntax to me 02:19:37 have you tried a simpler example to see if it works? 02:20:20 hmm. actually, I'm not certain it is, though it won't do what you think it will 02:20:45 in the exemple they use data 02:21:02 data Point = Pt {pointx, pointy :: Float} 02:21:41 from testing a bit, looks like you might need to always use it with data 02:21:42 or data T = C1 {f :: Int, g :: Float} | C2 {f :: Int, h :: bool} 02:21:55 * Heffalump looks around for Igloo, since he's too lazy to check the report himself 02:22:10 * Logan yawns. 02:23:40 mmm another problem: type Neuron = SumFct. With this my prog compile, and if i replace with data Neuron = SumFct it doesn't 02:25:04 "data Neuron = SumFct" is almost certainly not what you mean 02:25:24 since it's defining a datatype Neuron with a single element, "SumFct" 02:26:25 well, I would like to have a type Neuron which is a tuple of function (weight function, sum function ...) and give name to field 02:28:47 well, I fear i should code the function myself 02:36:47 I just found out that a cheesy little program I made a while back is actually in the Debian tree! 02:38:12 cool! what is it? 02:40:13 is there a function which takes the element n of a tuple or should I use pattern matching ? 02:43:51 fst and snd are defined in the prelude for pairs. 02:43:57 shapr: xmms-shell 02:44:03 But I don't like how they packaged it. 02:44:06 They didn't compile it with readline. 02:45:14 heh, I've even written an elisp lib to talk to xmms-shell 02:45:29 Cool. 02:45:32 I'm thinking of rewriting it. 02:45:48 Make it more shell-script friendly. 02:45:51 I wish xmms would run without X :) 02:46:10 I can't use my xmms-shell stuff in console (unsurprisingly) 02:46:35 * Logan nods. 02:46:51 I know the XMMS developers would like to make that possible, but I don't see it happening anytime soon. 02:47:04 xmms has support for everything, great playlist support, etc 02:47:07 Logan: yes but I need the 3th,4th ... :) 02:47:44 thd :: (a, b, c, d) -> c 02:47:50 thd (_, _, x, _) = x 02:47:51 :P 02:48:00 Assuming a 4-tuple. 02:48:02 --- join: Yurik (~yrashk@gw.telcos.net.ua) joined #haskell 02:48:12 re 02:48:18 hi Yurik 02:48:36 shapr hi 02:48:40 what's up? 02:49:05 fine, thanks 02:52:54 Logan: that is what I did 02:53:38 my original question was to know if there exist a more beautiful way (like a function fct tuple n -> return the nth :) ) 02:55:47 Not unless you hard-code it to handle a specific tuple length. 02:56:23 k 02:56:31 thx :) 02:56:42 Logan: you use emacs? 02:59:23 shapr: why ? 02:59:47 shapr: Nope. 02:59:55 I'm trying to figure out a certain regular expression 03:00:00 * Logan uses vim. 03:00:01 I use emacs/XEmacs 03:00:11 I want to match multi-line comments that start with (* and end with *) 03:00:38 :)) 03:00:43 Are they nested? 03:01:00 not usually 03:01:10 not that I'm aware of at least :) 03:01:23 problem is that . in emacs doesn't match a newline 03:02:24 "(\*.*?\*)" works on a single line 03:02:53 In perl at least you can specify multiline matching. 03:03:20 The problem with that regex is, if you make it multiline, it'll match (* blah blah blah *) ...... (* blah blah blah *). :P 03:03:20 I only know how to do it in flex/lex :) 03:03:51 Logan: even in non-greedy? 03:04:13 Oh,d idn't know you could specify that. 03:51:56 --- quit: cuelebre (Remote closed the connection) 03:58:03 --- join: cuelebre (~cuelebre@212.85.32.125) joined #haskell 04:02:53 I would expect multi-line non-greedy matching to work 04:04:14 * shapr wonders how to constrain strings in a newtype constructor to certain patterns 04:04:40 give an example? 04:05:03 newtype Gismu = Gismu String 04:05:19 -- must be of form CVCCV or CCVCV (C = consonant, V = Vowel) 04:06:37 Records indeed only work with data 04:07:34 shapr: then use data Gismu = CVCCV Consonant Vowel Consonant Consonant Vowel | CCVCV .... 04:07:46 I can't think of a way other than having data Consonant = Consonant_B | ... | Consonant_Z or similar 04:08:01 It would be easier to enforce it in the code I suspect 04:08:02 and yeah, you'd have to do what Igloo said too 04:08:14 you're asking the type-checker to do rather a lot here 04:08:23 well, that's what they're for :) 04:08:27 Haskell is all about typing 04:08:34 at least, from the Python viewpoint that's true 04:10:32 * shapr considers newtype Vowel and newtype Consonant 04:11:09 ya know, those constructors you guys came up with are really cool :) 04:11:11 I think I'll use that 04:15:06 --- quit: cuelebre ("part") 04:15:15 --- join: comatoast (boingo@dsl-206-55-130-48.tstonramp.com) joined #haskell 04:31:11 comatoast: y0 :) 04:31:14 I got distracted from work again 04:32:05 heh 04:32:29 so, I've got this .hs file... 04:32:32 yah? 04:32:38 isMonotonic f n 04:32:39 = mapping == qsort mapping -- is range list the same sorted? 04:32:39 where 04:32:39 mapping = map f range 04:32:39 range = [0..n] 04:32:58 now, I'd put an if __name__ == "__main__" here to test it out... 04:33:03 (in python) 04:33:08 ah 04:33:12 is there an equivalent thingy in haskell? 04:33:13 are you using Hugs or GHC? 04:33:16 hugs 04:33:24 ok, lemme find an url 04:34:35 http://pragmaticprogrammer.com/cgi-local/pragprog?QuickCheck 04:35:53 * shapr tries to figure out how to put lojban "." and "'" into Haskell types 04:36:11 heh 04:37:49 * shapr goes for Full_Stop 04:41:48 hm, I'd like to have a Gismu constructor that takes a name, and a function.. and the function can take from one to five args... 04:42:41 you need 5 different functions then 04:42:53 unless you do variable argument list evilness as described by ski a few days back 04:42:54 ok 04:43:04 sounds scary :) 04:43:22 I may need it though 04:43:33 some of these functions should act different depending on the number of args they got 04:43:42 can't they have different names? 04:44:26 well, not really 04:44:26 I'm trying to map the artifical language Lojban to Haskell somehow 04:44:54 tavla talk 'palaver' x1 talks/speaks to x2 about subject x3 in language x4 04:45:02 so "mi tavla" means "I speak" 04:45:11 but "mi tavla do" means "I speak to you" 04:45:35 and "tavla" by itself is the noun meaning "talk" 04:45:38 or "speech" 04:45:55 or "look, someone's talking!" 04:45:59 right 04:47:21 * shapr thinks about constructors 04:48:26 * shapr considers hacking lojban.yacc into a Happy compatible format 04:49:29 prop_RevRev xs = reverse (reverse xs) == xs 04:49:29 where types = xs::[Int] 04:49:32 urm 04:49:45 make sense? 04:49:55 I'm trying to disassemble that... 04:50:04 prop_RevRev is the name of the function, xs, the only argument... 04:50:27 where types = xs::[Int] 04:50:37 --- join: cuelebre (~cuelebre@212.85.32.125) joined #haskell 04:50:39 means the input should be any list of Int 04:50:52 Who wrote that code? 04:51:07 Igloo: it's from the ICFP QuickCheck paper 04:51:12 transcribed by me 04:51:19 so if it's fuct, it's probably my fault :) 04:52:02 shapr: now if the function took two args...how would the types bit go? 04:52:05 Hmmm, I think I'll have to look at that when I have a minute 04:52:45 that's my kind of contribution to the Open Source movement 04:53:04 I do something, but it's flaky, and then it irritates someone with real skill enough for them to fix it :) 04:53:14 * shapr grins 04:53:37 comatoast: well, what kind of properties should isMonotonic have? 04:53:59 It's not that, I just don't understand why they've writen it that way :-) 04:54:34 hm...well...I'd rather learn how to run the function with some test functions, rather than try and verify that isMonotonic actually works 04:54:38 (at this point) 04:54:42 Igloo: it's so that QuickCheck can throw a 100 random (but typeful) sets of input data at the function, and then tell you if it really does work that way 04:55:10 Oh, it's an example of the *use* of it? Right :-) 04:55:11 ok, for the prop_RevRev example 04:55:43 you make sure your module imports QuickCheck 04:55:59 you dump it into Hugs 04:56:07 and you run quickCheck prop_RevRev 04:56:12 where should I put QuickCheck? 04:56:27 if it's in %PATH%, should I be OK? 04:56:38 I dunno 04:56:39 I mostly use ghc 04:57:04 I know it'll work if QuickCheck.hs is in the same dir 04:58:16 * comatoast slaps the www bobby 05:02:15 shapr: do I need to import QuickCheck into the .hs that I'm testing, or do I do that in the interpreter? 05:02:31 in the .hs 05:06:12 it works, cool 05:31:14 what's the op for exponentiation? **, ^, or something else? 05:32:11 ^ if positive exponent, ^^ if signed exponent (I think). 05:45:31 another newbie question: I've started up winhugs, and I've got this Prelude> prompt instead of a Main> prompt, and this one doesn't seem to do much compared to the dive-right-in python interpreter. Is there something that I need to do in order to make the prelude part go away so I can test stuff? 05:58:53 --- join: foonley (~nikhouri@boreas.ecs.syr.edu) joined #haskell 06:00:17 --- quit: foonley (Client Quit) 06:35:38 --- part: Yurik left #haskell 06:36:06 comatoast: still there? 06:36:09 yah 06:36:27 there's quite a bit of interactive stuff you can do in the hugs/ghci interpreter 06:36:39 but defining functions can be difficult there 06:36:42 right, but it's asking me to load something 06:36:52 :load /home/shae/src/haskell/Test.hs 06:36:56 that's the kind of stuff I do 06:37:07 though I use haskell-mode keys to do it automagically 06:37:20 you one of those emacs people, eh? 06:37:23 yup 06:40:34 invp x p = 1/x^p where types = -- how can I say that both x and p must be Ints? 06:41:04 for that kind of function definition, you'll need to edit a file and then load it 06:41:13 that's what I'm doing 06:41:32 invp :: Num => a -> b 06:41:48 that says input a, and return value b both have to be instances of the Num class 06:42:03 you can also just say "invp :: Int -> Int" 06:42:34 but invp takes two arguments... 06:42:45 invp :: Int -> Int -> Int 06:43:16 one interesting thing about Haskell is that under the hood, there are only functions that take one arg and return one arg 06:43:19 ick, that associativity will take a while to grow on me... :P 06:43:36 well, it's easy to tuplize.... 06:43:46 one cool part about that is that you can call invp 1 and get back a partially resolved function 06:44:18 that can be very spiffy if you put your most general arg first, and you have to do some processing of that arg before you use the later args 06:44:23 make sense? 06:44:58 shapr: yeah, C++ oddballs have something called 'partial specialization' of templates 06:45:47 I'm fond of the whole idea 06:46:28 in Python it's not very easy to do that 06:48:22 I have a list of Nums (maybe Ints, I'm not sure)...is there a builtin way to find the sum of the elements? 06:49:35 sum 06:49:56 heh, there we go 06:54:43 ok, I'm not sure how I goofed up the syntax... 06:54:44 prop_RevRev xs = reverse (reverse xs) == xs 06:54:44 where types = xs::[Int] 06:54:44 p_Series :: Int -> Int -> Int 06:54:44 p_Series len p = 06:54:44 nums = [1 .. len] -- ERROR "D:\projects\mon.hs":15 - Syntax error in input (unexpected `=') 06:54:46 sum map invp nums 06:54:48 invp :: Int -> Int -> Int 06:54:50 invp x p = 1/x^p 06:54:59 the comment's on line 15 07:21:45 --- join: tmoertel (~chatzilla@pa-mtlebanon2a-268.pit.adelphia.net) joined #haskell 07:24:22 * tmoertel wonders if anybody is home . . . 07:49:37 * shapr isn't sure 07:49:47 hi tmoertel! 07:50:03 hi shapr! how's it going? 07:50:16 passably well 07:50:26 workin on Zope, lusting after Haskell 07:50:32 how are things for you? 07:50:50 How do you like python? 07:51:04 Python is awesome, amazing, incredible, and beautiful 07:51:18 I still wish it had first class continuations though 07:51:40 Don't we wish *all* languages had 1st-class call/cc, though? ;-) 07:51:48 well, *I* do 07:52:05 but most people I've spoken to don't know what a continuation is 07:52:14 continuation? 07:52:17 see? 07:52:21 * comatoast bows 07:52:23 * shapr teases comatoast 07:52:39 I see. 07:53:22 comatoast: it'd take me about fifteen minutes to fully explain continuations, and I'm working right now :( 07:53:45 but soon 07:54:16 heh, k 07:55:05 Here's FOLDOC's explanation: http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=call%2Fcc 07:57:30 See also http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?continuation+passing+style 07:58:31 And for a list of references: http://library.readscheme.org/page6.html 08:30:35 ok, cool 08:30:51 why is this such a big deal, though? 08:32:17 it's not. the concept is just a bit hard to understand 08:32:47 well, instead of returning r, you just run it through another unary function before really returning it 08:33:18 ...where's the sex appeal in that? 08:33:42 yes, the other function is the continuation of the current function 08:33:54 chaining continuations? 08:34:33 Monads ? 08:34:52 there is call/cc. with it you can get the current continuation. this basically allows different kind of control flow 08:37:02 What does it give you that higher order functions don't? 08:37:23 you can implement exceptions or threads with 1st class continuations but most languages have these anyways 08:39:06 say you have "callcc (\x -> c x); y" where c is another continuation, then you can come back from c to run y 08:40:14 continuation monad can be implemented using higher-order functions 08:41:11 I didn't follow that 08:41:48 which one? 08:42:01 say you have "callcc (\x -> c x); y" where c is another continuation, then you can come back from c to run y 08:42:59 what's a Fractional Int? 08:43:48 You're trying to use an Int where you need to use something which has a Fractional instance 08:44:07 right, but what are they? 08:44:38 I assume they're not floating-point representations of stuff... 08:48:44 See the report for details 08:49:01 * Igloo can't remember precisely what each class is OTTOMH 08:49:47 Igloo: wait ... 08:54:00 haskell roxx 08:55:50 Where are you getting Fractional Int from? 08:56:32 Igloo : hugsfor win has a beatiful clase hierachy diagram 08:56:41 Do you mean something like: 1 % 3 :: Integral a => Ratio a ? 08:56:56 --- join: discobob (discobob@jump-v90-2120.customer.jump.net) joined #haskell 08:57:11 Igloo: let's just summarize that the main feature of 1st class continuations is obfuscation 08:57:24 --- quit: tmoertel (Read error: 104 (Connection reset by peer)) 08:58:15 --- quit: discobob (Read error: 104 (Connection reset by peer)) 08:58:19 --- join: tmoertel (~chatzilla@pa-mtlebanon2a-268.pit.adelphia.net) joined #haskell 08:58:31 I don't want to obfuscate my code though 08:58:47 * tmoertel scrapes bits of exploded Mozilla off of monitor 08:59:29 --- quit: tmoertel (Read error: 104 (Connection reset by peer)) 08:59:36 --- join: discobob (discobob@jump-v90-2120.customer.jump.net) joined #haskell 09:05:32 --- join: tmoertel (~chatzilla@pa-mtlebanon2a-268.pit.adelphia.net) joined #haskell 09:06:24 * tmoertel tries again, this time with a newer build of Mozilla 09:11:09 x is the continuation of "callcc (\x -> c x)", which starts with y. you give to c x as an argument, so the computation in c can come back to x and thus start computing forward from y 09:15:01 http://www.willamette.edu/~fruehr/haskell/evolution.html <--and I thought perl was the master of tmtowtdi 09:18:26 if you want to experiment with continuations use: f >>= g cont = f (\x -> g x cont); return x cont = cont x; call_cc f cont = f (\arg c -> cont arg) cont 09:48:50 --- quit: comatoast (".NET install") 09:49:52 * shapr tries to figure out how to deal with a type of IO [FilePath] 09:51:31 what's the data in it? 09:51:52 putStr $ getDirectoryContents "/tmp/fub" 09:52:11 I hacked up a Python script that uses a list comp, so I thought I'd try to rewrite it in Haskell 09:53:13 putStr has the wrong type hasn't it? 09:53:30 getDirectoryContents "/tmp/fub" >>= putStr ? 09:53:37 it finds all the files with in the current directory that have a purely numeric filename, creates a new file that has a name of one greater number than the max, and writes from stdin to the file 09:54:05 * shapr tries that 09:54:14 hangon, I'm confused as to what you're actually trying to do 09:54:39 here's the obfuscated Python I just wrote: 09:54:41 with the IO [FilePath] that is 09:54:42 open(str(max([int(i) for i in os.listdir('.') if re.compile('^[0-9]+$').match(i)]or[0])+1),'w').write(sys.stdin.read()) 09:54:45 oh 09:55:14 OIC. 09:55:20 just print the list of files so far 09:55:26 you can really read that line of Python? =) 09:55:27 wow 09:55:39 so do something like: do files <- getDirectoryContents "/tmp/pub" 09:56:00 let numfiles = filter (some predicate to check for all numbers) files 09:56:16 let numbers = map (something to change the numeric strings into numbers) numfiles 09:56:38 let newfilename = toString (maximum numbers + 1) 09:56:39 ... 09:56:44 and get the indentation right 09:56:58 heh :) 09:57:01 * shapr bounces happily 09:57:21 you also might want to merge the filter and the map into some function that does it all at once 09:57:36 but that's a rough idea anyway 09:57:44 thanks! 09:57:50 * shapr hacks along 10:17:53 The heavily composed version: 10:17:59 let dir = "/path/to/dir" 10:18:05 s <- getContents 10:18:09 getDirectoryContents dir >>= 10:18:17 flip writeFile s . (dir++) . ('/':) . show . (+1) . maximum . ([0::Int]++) . map read . filter (all (`elem`['0'..'9'])) 10:18:28 ;-) 10:19:37 * Heffalump accuses tmoertel of being evil. 10:20:04 but only just a little . . . 10:20:56 yes, I've seen rather worse :-) 10:21:11 do you know Richard Bird by any chance? 10:21:18 no 10:21:36 it's just that kind of thing he likes 10:21:43 "pointfree" programming 10:22:10 If the Unix shell pipe operator (|) is good, how can Haskell's (.) be bad? ;-) 10:23:05 :-) 10:23:44 * Heffalump thinks ([0::Int]++) should be ((0::Int):) 10:24:20 indeed, that would be more consistent with my use of ('/':) earlier 10:24:57 hmm, I wonder if there's a better place for the ::Int 10:25:49 I guess not 10:25:50 oh well 10:26:04 It's not really needed 10:26:24 errm, there'll be unresolved overloading without it, won't there? 10:26:45 No, the type will just be ugly: (Ord a, Read a, Num a) => [[Char]] -> IO () 10:27:01 which is unresolved overloading, since a doesn't appear free in [[Char]] -> IO () 10:27:16 and YM (Ord a, Read a, Show a) don't you? 10:27:26 It'll default to Integer, which isn't a tremendously bad thing 10:27:54 You need Num for the +1 10:28:02 bingo 10:28:17 oh, so it did 10:28:25 show . (+1) . read $ "0" ===> "1" 10:28:27 ah, you need Ord for the maximum 10:28:59 Yup - and Ord was in your list too 10:29:32 oh, Show then 10:29:47 anyway, I stand corrected on the main point 10:35:28 (actually Num implies Show) 10:35:37 right 11:07:02 * cuelebre say bye , bye 11:33:49 --- log: started haskell/02.02.07 11:33:49 --- join: clog (nef@bespin.org) joined #haskell 11:33:49 --- mode: carter.openprojects.net set mode: +n 11:33:49 --- names: list (clog) 11:45:14 --- log: started haskell/02.02.07 11:45:14 --- join: clog (nef@bespin.org) joined #haskell 11:45:14 --- topic: 'Have a library you'd like to donate, or one you'd like to see? Talk to us at http://sf.net/projects/haskell-libs/ | we be loggin' http://tunes.org/~nef/logs/haskell/ | welcome to the Haskell Dojo | julien is up to white belt! jewel and shapr are up to green belt!' 11:45:14 --- topic: set by shapr on [Wed Jan 30 14:36:17 2002] 11:45:14 --- names: list (clog yusri Logan jewel xbill Heffalump Igloo shapr jemfinch ChoJin discobob tmoertel smkl pHa) 11:49:15 --- quit: discobob ("Client Exiting") 13:41:12 --- quit: tmoertel (Read error: 104 (Connection reset by peer)) 13:42:15 --- join: tmoertel (~chatzilla@pa-mtlebanon2a-268.pit.adelphia.net) joined #haskell 15:33:46 --- quit: ChoJin ("bye !!!") 16:37:22 --- join: juhp (~petersen@firebox-ext.jp.redhat.com) joined #haskell 18:45:16 --- quit: xbill (Read error: 104 (Connection reset by peer)) 21:28:56 --- join: jemfinch` (~jemfinch@rnie-99-168.resnet.ohio-state.edu) joined #haskell 21:28:56 --- quit: tmoertel (Read error: 104 (Connection reset by peer)) 21:30:50 --- quit: jemfinch (Read error: 104 (Connection reset by peer)) 21:43:53 --- quit: juhp (carter.openprojects.net irc.openprojects.net) 21:43:53 --- quit: pHa (carter.openprojects.net irc.openprojects.net) 21:44:56 --- join: juhp (~petersen@firebox-ext.jp.redhat.com) joined #haskell 21:44:56 --- join: pHa (sjh@Sprint215.tbaytel.net) joined #haskell 21:45:57 --- join: jemfinch_ (~jemfinch@rnie-99-168.resnet.ohio-state.edu) joined #haskell 21:46:01 --- quit: jemfinch` (Remote closed the connection) 23:43:55 --- join: xbill (wli@DOMINIA.MIT.EDU) joined #haskell 23:59:59 --- log: ended haskell/02.02.07