00:00:00 --- log: started haskell/02.03.11 00:01:56 --- join: clausen (~andrew@c17997.eburwd3.vic.optusnet.com.au) joined #haskell 00:40:00 --- join: ChoJin (~ask@cha213245038031.chello.fr) joined #haskell 02:03:49 --- quit: ChoJin ("bye !!!") 03:59:04 --- join: DLid (hidden-use@host80-1-72-245.no-dns-yet.ntli.net) joined #haskell 04:00:48 what would the code be for taking a huge list of numbers and arranging each 8 numbers into a new list of type chop8 :: [Bit] -> [[Bit]] ?? 04:01:34 have a look at groupBy 04:01:43 (or is it partition) 04:02:16 cant i right a simple recursion method without this 04:02:37 yep 04:02:57 which would be? 04:03:08 take 8() 04:03:13 dunno 04:03:18 I'm looking for the elegant solution 04:03:18 hehe 04:04:28 chop8 [] = [] 04:05:01 chop8 xs = [take 8 xs]:(chop8 (drop 8 xs)) 04:06:13 YM chop8 xs = take 8 xs:chop8 (drop 8 xs) 04:06:29 yep, last one, thought so 04:06:39 oops 04:06:45 yeah, the [...] are wrong 04:07:04 my eyes feel sore without the brackets, though 04:14:27 --- quit: DLid () 04:29:38 --- quit: clausen ("send all money to /dev/clausen") 07:12:49 --- join: DLid (hidden-use@host80-1-72-245.no-dns-yet.ntli.net) joined #haskell 07:13:27 im trying to define a function decode :: [Bit] -> String 07:13:43 and need to use... 07:13:45 bin2nat :: [Bit] -> Int 07:13:45 bin2nat = foldr (\b sum -> b + 2*sum) 0 07:13:52 so, what i have is... 07:14:04 decode [] = [] 07:14:04 decode ds = chr (bin2nat ds) ++ decode ds 07:14:24 however, this is returning [Char] when it needs Char 07:14:27 could someone help please 07:14:44 String is [Char], though 07:15:00 you probably need : not ++ 07:15:07 well its returning this error... 07:15:07 Type checking 07:15:08 ERROR "C:\Program Files\Haskell\course.hs":37 - Type error in applic 07:15:08 ation 07:15:08 *** Expression : chr (bin2nat ds) ++ decode ds 07:15:08 *** Term : chr (bin2nat ds) 07:15:09 and decode ds on the left-hand side should probably be decode (d:ds) 07:15:10 *** Type : Char 07:15:12 *** Does not match : [Char] 07:15:23 yeah, so that's returning Char when it needs to be [Char] 07:15:25 i tried : but then it just keeps executing \r until i kill the process 07:15:42 that's because you said decode ds = something : decode ds 07:15:49 so it'll just go round in circles running decode ds 07:15:54 ok, so the decode ds should be infront 07:16:29 no, you need to remove the bits that bin2nat will deal with before calling decode again 07:16:43 probably something like decode ds = chr (bin2nat ds) : decode (drop 8 ds) 07:17:26 i get this error 07:17:26 *** Expression : decode ds (drop 8 ds) 07:17:26 *** Term : decode 07:17:26 *** Type : [Bit] -> String 07:17:26 *** Does not match : a -> b -> c 07:17:56 that's because you have an extra ds in there. 07:18:44 so the line decode [1,0,1,1,1,1,1,1] 07:18:47 no outputs... 07:18:51 now outputs 07:18:57 "\253" 07:19:09 that sounds right 07:20:33 now i also have a transmit function to see if all my code is right 07:20:43 ive written the code... 07:20:44 transmit :: String -> String 07:20:44 transmit ts = decode (encode ts) 07:20:53 where decode... 07:20:58 decode :: [Bit] -> String 07:20:59 decode [] = [] 07:20:59 decode ds = chr (bin2nat ds) : decode (drop 8 ds) 07:21:01 and encode is... 07:21:06 encode :: String -> [Bit] 07:21:07 encode [] = [] 07:21:07 encode (e:es) = make8 (nat2bin (ord e)) ++ encode es 07:21:13 i thought this would work 07:21:17 but it doesnt... 07:21:27 transmit "Hugs" 07:21:28 Reading file "C:\Program Files\Haskell\course.hs": 07:21:28 " 07:21:28 Program error: {primIntToChar 1936160072} 07:21:52 what does this mean, do you know? 07:22:30 I think it means that you tried to convert an integer that was too big to a character 07:22:54 why is it doing this? 07:25:25 can you email the entire program to ganesh@earth.li ? 07:25:39 I can't see any reason why it would be off the top of my head 07:26:05 could i post you it on Priv MSG? 07:26:17 I'd have to paste it line by line into a file then 07:26:25 ok... 07:26:34 .t 07:26:35 oops 07:26:57 that was meant to be a no. 07:27:14 It's beause decode is missing a take 8 07:27:15 as in *don't* send it to me by private msgs. 07:27:23 ohhh. duh. 07:27:28 yes 07:27:49 * Heffalump had forgotten the definition of bin2nat and was assuming it did that itself 07:29:44 so it would be 07:29:47 decode ds = chr (bin2nat (take 8 ds)) : decode (drop 8 ds) 07:30:06 yeah 07:30:16 cheers! 07:34:16 --- quit: DLid () 08:40:08 --- join: Yurik (~yrashk@gw.telcos.net.ua) joined #haskell 11:05:35 --- join: salice (antifon@A09fd.pppool.de) joined #haskell 11:06:22 --- join: ChoJin (~ask@cha213245038031.chello.fr) joined #haskell 11:24:42 --- quit: salice ("Leaving") 11:44:45 --- nick: Yurik -> Yurik[gone] 12:33:38 --- nick: LoganH -> Logan 13:14:11 Heh, I love the "Rationale" section here: http://www.perldoc.com/cpan/Gimp.html 13:41:25 Logan: that's a Perl programmer. 13:41:59 Anyone who programs Perl and thinks "Scheme is the crappiest language ever" has seriously mental issues. 13:42:17 Hey, I program perl and think Scheme is one of the crappiest languages ever. :P 13:42:28 well... 13:42:30 :) 13:43:23 A language that goes so far out of its way to avoid syntax that it ends up introducing syntax in unorthogonal ways. 13:43:34 how does scheme do that? 13:44:22 syntax (or the lack thereof) is really the only thing I especially like about scheme : 13:44:26 er, :) 13:48:48 So much syntax is missing at the most intuitive level (no keywords, no operators, no structures at all, just s-expressions) that, in order to actually attain any level of expressability, there have to be non-orthogonal "special forms" to make up for it. 13:49:31 like what? And what makes the special forms any more non-orthogonal than keywords in other languages? 13:49:45 (also, do you perchance know SML?) 13:50:05 So you end up having to remember the special forms, which are just as much syntax as, say, knowing if then else in haskell. 13:50:17 I'm vaguely familiar with it, but most of that familiarity is through haskell, I suppose. 13:50:41 I'm just on a search to find out what "abstype" does. 13:50:49 I figure if there's going to be grammar that has to be learned anyway (which I consider a good thing), you might as well get rid of these stupid, over-simplified s-expressions. 13:51:35 You need a certain amount of grammar to be able to express most concepts, and scheme (like lisp) has grammar, it's just mostly in its special forms. :P 13:52:09 I also dislike how much knowledge of the imperative underpinnings of the language you need to know to do some things. 13:52:14 And how impossible it is to debug. 13:52:26 But I'm mostly venting because I had to do a scheme program for class this week. :P 13:52:28 Logan: I don't really agree with you. I think Scheme has one of the most orthogonal syntaxes around (special forms and all) and I think their macros are pretty interesting. 13:52:39 what are you defining as "special forms"? 13:53:23 From the MIT Scheme reference: 13:53:25 A parenthesized expression that starts with a syntactic keyword is a special form. Each special form has its own syntax, which is described later in the manual. The following list contains all of the syntactic keywords that are defined when MIT Scheme is initialized: 13:54:19 I'm not saying the particular syntax they choose is bad; I'm saying that obscuring it all under a layer of s-expressions is a pointless design. 13:54:37 do you mean special forms like set!, or define? 13:54:41 I mean all of them. 13:54:50 All 37 in this list. 13:55:05 I think haskell shows how it can be done cleanly in a more conventional grammar. 13:55:11 A human-readable and human-writable grammar. :P 13:55:14 why is that syntactically strange? Those special forms are not any different than keywords... 13:55:37 What is strange is the usage of parenthesized list expressions for everything. 13:55:41 People can write lexers and parsers for scheme *loads* easier than they can do the same for Haskell :) 13:55:48 Of course. 13:55:59 That's true of assemblers as well. :P 13:56:05 Logan: it's the whole code-is-data thing, and it's what lets Scheme (or Lisp) have such flexible macro systems. 13:56:24 Well, I'm not too familiar with the macros. 13:56:32 there are a lot of things to dislike about scheme, but I don't think syntax is one of them. 13:56:45 I'm just expressing a stylistic opinion that a programming language should be more like a natural language than a machine language. 13:57:15 Else you completely lose the features of readability and writability that a programming language is intended to offer. 13:57:54 well, for what it's worth, I think the large majority of programmers knowing neither Scheme nor Haskell would have an easier time reading Scheme :) 13:58:07 I disagree. :P 13:58:27 Although haskell can be written so that it's obscure, it doesn't have to be. 13:58:34 While on the other hand scheme has to be written obscurely. 13:58:59 no, I really don't think that's true. 13:59:03 Once you teach someone all there is to know about s-expressions and special forms, _then_ they can read or write scheme, if they put a bit of thought into it. 13:59:15 Logan: you seem to think they're a lot to learn about special forms! 13:59:21 Maybe if you used lets and such generously enough. 13:59:32 Not really. 13:59:40 It's no more of a burden than any other language. 13:59:51 It's the readability of the expressions with which you have to express everything that is difficult. 14:00:12 give me some examples of hard to read Scheme, if you don't mind. 14:03:54 Let me see if I can find a good example. 14:03:58 The problem is that I can read them. :P 14:04:20 The problem with readability and writability occurs when thinsg get really nested. 14:04:32 With cars and cdrs all over the place. 14:04:42 Especially when you're trying to work with some sort of data structure. 14:06:33 This little function I had to write for this project illustrates a few problems... 14:06:34 (define (play-round p) 14:06:34 (let 14:06:34 ( 14:06:34 (strategies (map car p)) 14:06:36 (histories (map car p)) 14:06:39 ) (let 14:06:42 ( 14:06:44 (results (map (lambda (x) (play-strategy strategies histories x)) player-combos)) 14:06:46 ) (map (lambda (x y) update-player results x y) p results) 14:06:49 ) 14:06:52 ) 14:06:54 ) 14:06:57 The first problem is the difficulty of representing data in scheme. 14:07:03 that's *really* strange scheme style, btw. 14:07:07 I'd have to include comments specifying the structure of p. 14:07:18 I'm sure it is, I've not written much scheme code. 14:07:48 The other problem (and maybe it's because I don't know enough scheme), is that there's nothing as convenient as partial function application in haskell, so I have all these lambdas. 14:08:22 What's so strange about it? 14:08:59 well, for one, no one ever puts parens on a line by themselves :) 14:10:51 * Logan shrugs. 14:10:54 That was pretty arbitrary. 14:11:08 I had a hard time reading lets... It was hard for me to distinguish the bindings from the actually expression they are used in. 14:11:53 well, without macros, I suppose it's hard to see the beauty of Scheme. 14:12:10 I'd probably lose points if I used macros. :P 14:12:14 I'm not sure I've seen a macro. 14:12:52 let me note now that I don't ever code in Scheme :) 14:13:05 Haha. 14:13:09 Why not? 14:24:15 I like strict typing too much :) 14:24:41 I like functional programming, with real strict typing, algebraic types, immutable data structures, and so on. 14:25:31 Macros and syntax aren't really enough for me to truly use Scheme. 14:25:45 What I would *love* to see is an ML with a scheme-like syntax, with macros and all. 14:25:48 *that* would rock. 14:28:32 What does algebraic type mean? 14:29:22 Sum types...like, "type 'a list = Cons of 'a * 'a list | Nil" 14:31:38 what data types does Haskell offer? 14:33:12 Enumerated types, lists, tuples, records, type constructors, not really sure what to call it all. 14:33:46 Sum types in ML are basically tagged unions. 14:34:06 and then you match on them (case, in Haskell) to mess with the inside. 15:56:59 --- quit: ChoJin ("bye !!!") 19:14:15 --- quit: Igloo (carter.openprojects.net irc.openprojects.net) 19:14:52 --- quit: Yurik[gone] (carter.openprojects.net irc.openprojects.net) 19:14:52 --- quit: Logan (carter.openprojects.net irc.openprojects.net) 19:14:52 --- quit: smkl (carter.openprojects.net irc.openprojects.net) 19:14:52 --- quit: arete (carter.openprojects.net irc.openprojects.net) 19:14:52 --- quit: jemfinch (carter.openprojects.net irc.openprojects.net) 19:14:52 --- quit: Heffalump (carter.openprojects.net irc.openprojects.net) 19:14:52 --- join: Yurik[gone] (~yrashk@gw.telcos.net.ua) joined #haskell 19:14:52 --- join: Logan (~logan@up112.blacksburg.ntc-com.net) joined #haskell 19:14:52 --- join: Igloo (~igloo@c93.keble.ox.ac.uk) joined #haskell 19:14:52 --- join: smkl (~sami@glubimox.yok.utu.fi) joined #haskell 19:14:52 --- join: arete (arete@greenland.spottedfly.com) joined #haskell 19:14:52 --- join: jemfinch (~jemfinch@rnie-99-43.resnet.ohio-state.edu) joined #haskell 19:14:52 --- join: Heffalump (ganesh@munchkin.comlab.ox.ac.uk) joined #haskell 20:45:57 --- join: tmoertel (~chatzilla@pa-mtlebanon2a-68.pit.adelphia.net) joined #haskell 21:23:55 --- join: clausen (~andrew@c17997.eburwd3.vic.optusnet.com.au) joined #haskell 21:38:32 --- quit: tmoertel (Read error: 104 (Connection reset by peer)) 22:52:04 --- join: Wittekind (~Cynophobe@B8d22.pppool.de) joined #haskell 22:52:13 --- part: Wittekind left #haskell 23:59:59 --- log: ended haskell/02.03.11