Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2012-07-07 03:36:53--> CSWookie (473e8c88@gateway/web/freenode/ip.71.62.140.136) has joined
- 2012-07-07 03:36:57--> Bytter_ ([email protected]) has joined
- 2012-07-07 03:37:15<-- wespee has quit irc
- 2012-07-07 03:37:56--> orn ([email protected]) has joined
- 2012-07-07 03:38:09<-- raichoo has quit irc
- 2012-07-07 03:38:41<-- srid has left
- 2012-07-07 03:39:06--> wespee ([email protected]) has joined
- 2012-07-07 03:39:10--> realitygrill ([email protected]) has joined
- 2012-07-07 03:39:33--> noddy ([email protected]) has joined
- 2012-07-07 03:39:36<-- glguy has quit irc
- 2012-07-07 03:40:28<realitygrill> at what point do you become an intermediate haskeller?
- --
- 2012-07-07 03:50:23<-- llcawthorne has quit irc
- 2012-07-07 03:50:46--> Pp537_ ([email protected]) has joined
- 2012-07-07 03:50:49--> amop ([email protected]) has joined
- 2012-07-07 03:50:55--> unnali ([email protected]) has joined
- 2012-07-07 03:52:39<parcs`> favonia: what does U(L) mean?
- 2012-07-07 03:52:59<favonia> parcs`: Unpackable(Lazy)
- 2012-07-07 03:53:33<amop> is there an acid-state or ixset channel on this server?
- 2012-07-07 03:54:04--> ryb ([email protected]) has joined
- 2012-07-07 03:54:18<-- revlis has quit irc
- 2012-07-07 03:54:43<donri> amop: #happs works
- 2012-07-07 03:54:53<CSWookie> I forget, did I say something about needing help understanding indentation? If I didn't, I do.
- 2012-07-07 03:54:56<donri> or #haskell for that matter
- 2012-07-07 03:54:59<amop> ixset question: i've built a couple indexes using ixFun, but my queries using @= are only using the first one.
- 2012-07-07 03:55:13<donri> CSWookie: shoot
- 2012-07-07 03:55:24<donri> amop: show code
- 2012-07-07 03:55:26<donri> @hpaste
- 2012-07-07 03:55:26<lambdabot> Haskell pastebin: http://hpaste.org/
- 2012-07-07 03:55:37<-- otters has quit irc
- 2012-07-07 03:56:24<-- cdidd has quit irc
- 2012-07-07 03:56:49--> otters (~otters@oftn/member/otters) has joined
- 2012-07-07 03:56:50<-- realitygrill has quit irc
- 2012-07-07 03:57:03<donri> CSWookie: please ask in the channel rather than in private
- 2012-07-07 03:57:06<favonia> parcs`: http://www.haskell.org/ghc/docs/latest/html/users_guide/faster.html
- 2012-07-07 03:57:14<donri> CSWookie: you can indent function arguments just fine
- 2012-07-07 03:57:36--> cdidd ([email protected]) has joined
- 2012-07-07 03:58:19<CSWookie> pardon, donri. I just started using the webchat and thought red meant private.
- 2012-07-07 03:58:37<donri> nope :) it means someone mentioned your nickname
- 2012-07-07 03:59:10<-- milkpost_ has quit irc
- 2012-07-07 03:59:25<-- Zenmaker_ has quit irc
- 2012-07-07 03:59:49--> Zenmaker_ ([email protected]) has joined
- 2012-07-07 04:00:54--> gbluma ([email protected]) has joined
- 2012-07-07 04:01:51<hpaste> CSWookie pasted Б─°indent helpБ─² at http://hpaste.org/71032
- 2012-07-07 04:01:52<hpaste> CSWookie pasted Б─°indent helpБ─² at http://hpaste.org/71033
- 2012-07-07 04:02:20<-- jellybaby1 has quit irc
- 2012-07-07 04:02:45<palmfrond> anyone else from hawaii? (oahu)
- 2012-07-07 04:02:52<CSWookie> Wow. I've evidently done a lot to offend the linter...
- 2012-07-07 04:03:39<blackdog> palmfrond: dysinger is
- 2012-07-07 04:03:42<-- tafryn has quit irc
- 2012-07-07 04:03:49<blackdog> oh, he doesn't hang out here, that's right.
- 2012-07-07 04:03:55<palmfrond> which chan is he in?
- 2012-07-07 04:04:06<blackdog> @dysinger on twitter.
- 2012-07-07 04:04:07<lambdabot> Unknown command, try @list
- 2012-07-07 04:04:16<donri> CSWookie: the indentation doesn't make the lines into separate arguments though, so add appropriate parenthesis
- 2012-07-07 04:04:27<blackdog> he'd be chuffed to know there are other hawaiian haskellers tohugh :)
- 2012-07-07 04:04:54<CSWookie> blackdog: Is chuffed good or bad?
- 2012-07-07 04:05:16<palmfrond> nah i'm interested in irc hawaiians
- 2012-07-07 04:06:08<blackdog> CSWookie: chuffed is bonza.
- 2012-07-07 04:06:24* blackdog is unhelpful :)
- 2012-07-07 04:07:00<blackdog> but yes, chuffed = pleased
- 2012-07-07 04:07:01--> sgronblo ([email protected]) has joined
- 2012-07-07 04:07:01<CSWookie> blackdog: The only person I've ever heard say bonza was Monterey Jack.
- 2012-07-07 04:07:14<CSWookie> He say it like it was a good thing.
- 2012-07-07 04:07:22<blackdog> it is a good thing
- 2012-07-07 04:07:29<blackdog> old australian slang.
- 2012-07-07 04:07:40<blackdog> too right mate, stone the crows etc
- 2012-07-07 04:08:27<CSWookie> I wish Hoosiers had cool slang :(
- 2012-07-07 04:08:54--> Lajjla (~Lajla@2001:0:5ef5:79fb:1c30:e64:ae33:eb94) has joined
- 2012-07-07 04:09:36<-- strmpnk has quit irc
- 2012-07-07 04:09:36--> narasim_7 ([email protected]) has joined
- 2012-07-07 04:09:46--> jellybaby1 ([email protected]) has joined
- 2012-07-07 04:10:09--> cinemod ([email protected]) has joined
- 2012-07-07 04:11:08<-- Lajla has quit irc
- 2012-07-07 04:12:13--> edwardk (~edwardk@pdpc/supporter/professional/edwardk) has joined
- 2012-07-07 04:13:45<amop> hpaste.org/71034
- 2012-07-07 04:14:00<-- Pp537_ has quit irc
- 2012-07-07 04:14:40--> Pp537 ([email protected]) has joined
- 2012-07-07 04:14:54--> bradleyayers ([email protected]) has joined
- 2012-07-07 04:15:42<blackdog> CSWookie: the problem with american slang is that everyone with a tv or internet access has heard it already.
- 2012-07-07 04:15:58<MostAwesomeDude> blackdog: Not necessarily.
- 2012-07-07 04:16:11<MostAwesomeDude> I was having fun explaining to some British pals what "ghost riding the whip" is.
- 2012-07-07 04:16:16<-- otters has quit irc
- 2012-07-07 04:16:28<blackdog> i thought ghost riding was getting out of a moving car...
- 2012-07-07 04:16:47<blackdog> i almost don't want to know what it actually means, it's beautiful in its inscrutability
- 2012-07-07 04:17:11--> otters (~otters@oftn/member/otters) has joined
- 2012-07-07 04:17:35<-- sgronblo has quit irc
- 2012-07-07 04:17:57<-- fgomez has quit irc
- 2012-07-07 04:17:57<-- danharaj has quit irc
- 2012-07-07 04:17:59--> sgronblo ([email protected]) has joined
- 2012-07-07 04:18:04--> fgomez ([email protected]) has joined
- 2012-07-07 04:18:35<CSWookie> Maybe it's what the guy that tells the guy who gives a political party it's marching orders does.
- 2012-07-07 04:18:46<CSWookie> Is that what it is MostAwesomeDude ?
- 2012-07-07 04:20:25<edwardk> preflex: xseen roconnor
- 2012-07-07 04:20:25<preflex> roconnor was last seen on freenode/#haskell 7 hours, 41 minutes and 52 seconds ago, saying: I sequenced my DNA and I found a bitmap of an alien crashlanded in a dutch farm field.
- 2012-07-07 04:21:13<Gavilan> Does anyone has any idea/suggestion of an interesting, complex and difficult software design problem (or domain) to solve/model as an exercise/example? yet small in scope? which uses only "common" knowledge?
- 2012-07-07 04:24:45--> raymank26 ([email protected]) has joined
- 2012-07-07 04:25:29<-- mjonsson has quit irc
- 2012-07-07 04:27:17<CSWookie> Huh. I've put it all on one line and it still complains
- 2012-07-07 04:27:37<CSWookie> ghci does fine with it.
- 2012-07-07 04:27:39--> dan64 ([email protected]) has joined
- 2012-07-07 04:29:33<hpaste> CSWookie pasted Б─°indent help 2Б─² at http://hpaste.org/71035
- 2012-07-07 04:29:55<-- cinemod has quit irc
- 2012-07-07 04:34:23<hpaste> donri annotated Б─°indent help 2Б─² with Б─°indent help 2 (annotation)Б─² at http://hpaste.org/71035#a71036
- 2012-07-07 04:36:09<donri> CSWookie: also, you realize takeWhile (<1000) [1..] == [1..999]?
- 2012-07-07 04:37:01--> mpwd ([email protected]) has joined
- 2012-07-07 04:37:11<donri> uh, ignore me, sleep deprived ^_^
- 2012-07-07 04:37:51<-- mpwd has quit irc
- 2012-07-07 04:38:42<-- Rotaerk has quit irc
- 2012-07-07 04:40:05<-- zw01 has quit irc
- 2012-07-07 04:40:06--> strmpnk ([email protected]) has joined
- 2012-07-07 04:41:53<-- [[zz]] has quit irc
- 2012-07-07 04:41:54-!- kish_ is now known as kish
- 2012-07-07 04:41:56--> tel ([email protected]) has joined
- 2012-07-07 04:42:05<CSWookie> When I tried using union infix, first it complained about union being out of scope. I changed it to List.union, and I got I huge mess of error.
- 2012-07-07 04:42:36<-- ozgura has quit irc
- 2012-07-07 04:43:50<-- amathew has quit irc
- 2012-07-07 04:44:59--> amathew ([email protected]) has joined
- 2012-07-07 04:44:59<-- amathew has quit irc
- 2012-07-07 04:45:24--> amathew ([email protected]) has joined
- 2012-07-07 04:45:24<-- amathew has quit irc
- 2012-07-07 04:45:42<edwardk> @ask roconnor why is there a separate mkLenses for Lens.Family2? to get the type alias in the signature?
- 2012-07-07 04:45:42<lambdabot> Consider it noted.
- 2012-07-07 04:45:46<-- wesada has quit irc
- 2012-07-07 04:47:45<donri> edwardk: mkLenses isn't roconnor's code
- 2012-07-07 04:47:58<edwardk> donri: in Lens.Family2.TH
- 2012-07-07 04:48:10<donri> yea, that's dan burton
- 2012-07-07 04:48:17<geekosaur> at a guess, you didn't parenthesize enough when you tried to infix. I must also point out that "List" is an obsolete module; it should be Data.List,
- 2012-07-07 04:48:28<-- strmpnk has quit irc
- 2012-07-07 04:48:37<edwardk> ah
- 2012-07-07 04:48:45--> kcj (~casey@unaffiliated/kcj1993) has joined
- 2012-07-07 04:49:24--> Lajla ([email protected]) has joined
- 2012-07-07 04:50:34<edwardk> ok, the question still stands then ;)
- 2012-07-07 04:50:41<CSWookie> geekosaur: It seems like I've got about everything in there parenthesized... Is there a better way to get all the multiples of 3 than using map the way I am?
- 2012-07-07 04:50:55<CSWookie> It's awfully verbose.
- 2012-07-07 04:51:19<CSWookie> Or maybe... crusty...
- 2012-07-07 04:51:33<CSWookie> Although that's not a technical term
- 2012-07-07 04:51:54<-- NimeshNeema has quit irc
- 2012-07-07 04:51:56<-- liesen has quit irc
- 2012-07-07 04:52:09<shachaf> http://hackage.haskell.org/packages/archive/lens-family-th/0.1.0.0/doc/html/src/Lens-Family-TH.html , http://hackage.haskell.org/packages/archive/lens-family-th/0.1.0.0/doc/html/src/Lens-Family2-TH.html
- 2012-07-07 04:52:21<shachaf> Those are remarkably similar.
- 2012-07-07 04:52:52--> christopher ([email protected]) has joined
- 2012-07-07 04:53:30<-- Lajjla has quit irc
- 2012-07-07 04:54:27--> Volkov_ (18b95899@gateway/web/freenode/ip.24.185.88.153) has joined
- 2012-07-07 04:54:30--> realitygrill ([email protected]) has joined
- 2012-07-07 04:54:43<-- warpy has quit irc
- 2012-07-07 04:54:47<-- SeanTAllen has quit irc
- --
- 2012-07-07 04:55:18<-- orn has quit irc
- 2012-07-07 04:55:29<-- puzza007 has quit irc
- 2012-07-07 04:55:29<-- Raynos has quit irc
- 2012-07-07 04:55:29<-- lopex has quit irc
- 2012-07-07 04:55:37<-- tomh has quit irc
- 2012-07-07 04:55:40<-- mndrix has quit irc
- 2012-07-07 04:55:58<-- upgrayeddd has quit irc
- 2012-07-07 04:56:20<-- mimico has quit irc
- 2012-07-07 04:56:21<-- wilfredh has quit irc
- 2012-07-07 04:56:30<-- aristid-ic has quit irc
- 2012-07-07 04:56:51<geekosaur> CSWookie, I can think of a numbre of things. firstly, (\x -> x < N) is better written (< N). secondly, takeWhile (\num -> num < 1000) (map (*5) [1..])) should be the same as map (*5) [1..1000 `div` 5 - 1]
- 2012-07-07 04:56:58<-- kopi has quit irc
- 2012-07-07 04:57:20<-- Eridius has quit irc
- 2012-07-07 04:57:21<geekosaur> (and of course that last is a constant you can precompute; I'm just showing how you derive it)
- 2012-07-07 04:57:25--> JEntrep ([email protected]) has joined
- 2012-07-07 04:57:30<-- lambdanaut has quit irc
- 2012-07-07 04:57:33<-- strax has quit irc
- 2012-07-07 04:57:40<geekosaur> > 1000 `div` 5 - 1
- 2012-07-07 04:57:41<lambdabot> 199
- 2012-07-07 04:57:56--> Xorlev (u226@gateway/web/irccloud.com/x-kggchtwpzpakevum) has joined
- 2012-07-07 04:58:12--> si14 (u2619@gateway/web/irccloud.com/x-zjpsrhrfisrampuf) has joined
- 2012-07-07 04:58:54--> [[zz]] ([email protected]) has joined
- 2012-07-07 04:58:59--> lopex (u4272@gateway/web/irccloud.com/x-lmzhcdtsfpijefpi) has joined
- 2012-07-07 04:59:07<-- CSWookie has quit irc
- 2012-07-07 04:59:30--> Eridius (~kevin@unaffiliated/eridius) has joined
- 2012-07-07 05:00:23--> wilfredh (u159@gateway/web/irccloud.com/x-lzxtzsladbttagal) has joined
- 2012-07-07 05:01:32<-- amop has quit irc
- 2012-07-07 05:01:43--> dylukes (u3438@gateway/web/irccloud.com/x-twgbqvjdvqsftrpr) has joined
- 2012-07-07 05:03:13--> upgrayeddd (u2969@gateway/web/irccloud.com/x-qhzeckcckrbmqgmb) has joined
- 2012-07-07 05:03:24--> orn ([email protected]) has joined
- 2012-07-07 05:03:24<-- Eridius has quit irc
- 2012-07-07 05:03:46<-- mels has quit irc
- 2012-07-07 05:03:48<-- choffstein has quit irc
- 2012-07-07 05:04:53--> liesen (u167@gateway/web/irccloud.com/x-aulmqfcbwxrxgjik) has joined
- --
- 2012-07-07 05:14:29--> AfC ([email protected]) has joined
- 2012-07-07 05:16:32--> tomh (u501@gateway/web/irccloud.com/x-muyijlltkcxeegie) has joined
- 2012-07-07 05:18:53<-- julmuri has quit irc
- 2012-07-07 05:19:33<-- unnali has quit irc
- 2012-07-07 05:22:08<-- jfredett has quit irc
- 2012-07-07 05:23:06--> bartek (u5271@gateway/web/irccloud.com/x-eeffptncuvozscvr) has joined
- 2012-07-07 05:23:45<-- renzhi has quit irc
- 2012-07-07 05:24:39--> aristid-ic (u1599@gateway/web/irccloud.com/x-vbvoehzgzniyoqnv) has joined
- 2012-07-07 05:26:14--> revlis ([email protected]) has joined
- 2012-07-07 05:26:49<-- baldo has quit irc
- 2012-07-07 05:27:15--> CSWookie ([email protected]) has joined
- 2012-07-07 05:29:13--> Catnaroek (~eduardo@unaffiliated/shinydarkness) has joined
- 2012-07-07 05:31:07--> SeanTAllen (u4855@gateway/web/irccloud.com/x-zwkfxlwpdvxgijke) has joined
- 2012-07-07 05:33:57--> andrewffff ([email protected]) has joined
- 2012-07-07 05:34:44--> tafryn ([email protected]) has joined
- 2012-07-07 05:34:57--> hamishmack ([email protected]) has joined
- 2012-07-07 05:35:09<-- amisov has quit irc
- 2012-07-07 05:35:43<-- Axman6 has quit irc
- 2012-07-07 05:36:25--> ssbr__ (~scorchsab@python/site-packages/ssbr) has joined
- 2012-07-07 05:36:47<-- hamishmack has quit irc
- 2012-07-07 05:36:50<ssbr__> Where should I read about the exact _actual_ semantics of typeclasses? More than just this vague understanding of overloaded functions in the style of CLOS.
- --
- 2012-07-07 05:50:58<-- strmpnk has quit irc
- 2012-07-07 05:51:17<-- ryb has left
- 2012-07-07 05:52:15--> lambdanaut ([email protected]) has joined
- 2012-07-07 05:55:36--> ryb ([email protected]) has joined
- 2012-07-07 05:55:45<-- donri has quit irc
- 2012-07-07 06:00:21--> Eridius (~kevin@unaffiliated/eridius) has joined
- 2012-07-07 06:00:43--> peterhil` ([email protected]) has joined
- 2012-07-07 06:00:56--> hajimehoshi ([email protected]) has joined
- 2012-07-07 06:03:02<-- kyktommy has quit irc
- 2012-07-07 06:04:51<-- lambdanaut has quit irc
- 2012-07-07 06:05:20<-- CSWookie has quit irc
- 2012-07-07 06:05:42--> Y_Less ([email protected]) has joined
- 2012-07-07 06:06:16--> warpy_ (u1398@gateway/web/irccloud.com/x-ebrmchqgzhkqvyfx) has joined
- 2012-07-07 06:07:01--> potix2 ([email protected]) has joined
- 2012-07-07 06:08:41<-- Argue has quit irc
- 2012-07-07 06:10:13<ssbr__> geekosaur: yeah, I got that from the paper before I came back here :P
- 2012-07-07 06:10:22<ssbr__> I was like, "oh, crap, that was actually pretty simple"
- 2012-07-07 06:10:54<-- ablokzijl has quit irc
- 2012-07-07 06:14:01--> ttt-- ([email protected]) has joined
- 2012-07-07 06:14:48-!- LeNsTR|off is now known as LeNsTR
- 2012-07-07 06:15:16<-- augur has quit irc
- --
- 2012-07-07 13:26:54<lambdabot> 1
- 2012-07-07 13:27:00<morel> Lamen: see?
- 2012-07-07 13:27:19<morel> favonia: i don't know.
- 2012-07-07 13:27:29<Lamen> Ah! Now I see why...
- 2012-07-07 13:27:48<-- twanvl_ has quit irc
- 2012-07-07 13:28:08<shirt> Lamen: in haskell, function application has the highest precedence
- 2012-07-07 13:29:06--> timthelion ([email protected]) has joined
- 2012-07-07 13:29:16<mcstar> > id . id undefined undefined $ undefined
- 2012-07-07 13:29:19<lambdabot> *Exception: Prelude.undefined
- 2012-07-07 13:29:35<mcstar> so, thats not strictly true, that id 1 2 is incorrect
- 2012-07-07 13:29:59--> CSWookie ([email protected]) has joined
- 2012-07-07 13:30:06<-- One-t has quit irc
- 2012-07-07 13:30:16<-- Itkovian has quit irc
- 2012-07-07 13:30:23--> One-t ([email protected]) has joined
- 2012-07-07 13:30:24<shirt> can anyone recommend a Standard ML tutorial for someone who already knows Haskell?
- 2012-07-07 13:30:59<-- scopedTV has quit irc
- 2012-07-07 13:31:08<-- agumonkey has quit irc
- 2012-07-07 13:31:37<-- bishopplox has quit irc
- 2012-07-07 13:32:19<morel> i want a syntax for defining record-fields referring to other fields of the same record. i explained it here:
- 2012-07-07 13:32:21<hpaste> morel pasted Б─°C++'s "this" for Haskell's records?Б─² at http://hpaste.org/71041
- 2012-07-07 13:32:26<morel> any ideas?
- --
- 2012-07-07 13:36:21<shirt> favonia: i saw that one, it's quite long, but i'll give it an overview
- 2012-07-07 13:36:38<mcstar> > let fun a b = \x -> a ++ x ++ b in fun "12" "34" "56"
- 2012-07-07 13:36:41<lambdabot> "125634"
- 2012-07-07 13:36:43<mcstar> morel: ^^
- 2012-07-07 13:36:59<-- lohn has left
- 2012-07-07 13:37:02<mcstar> you can apply fun seemingly to 3 arguments, even if it takes 2
- 2012-07-07 13:37:24<favonia> shirt: I think you're able to skip most of them. my impression is that it's very rigorous and well-explained
- 2012-07-07 13:37:50--> agumonkey ([email protected]) has joined
- 2012-07-07 13:38:00<morel> mcstar: i know. what do you want to say?
- 2012-07-07 13:38:17<favonia> shirt: signatures, modules and functors will be new for Haskellers. also because of side effects there's an extra restriction on polymorphism
- 2012-07-07 13:38:34<-- CSWookie has left
- 2012-07-07 13:38:49<eikke> favonia: talking about ocaml?
- 2012-07-07 13:39:03<-- agumonkey has quit irc
- 2012-07-07 13:39:08<favonia> shirt: but I feel that's all (?) the things you have to learn
- 2012-07-07 13:39:24<favonia> eikke: standard ml. but they're very similar anyway.
- 2012-07-07 13:39:35<favonia> will ocaml minus the oo part
- 2012-07-07 13:39:37--> Irfan_A ([email protected]) has joined
- 2012-07-07 13:39:39<favonia> well ocaml minus the oo part
- 2012-07-07 13:39:47<eikke> i see :) (/me codes ocaml at daytime, haskell at night)
- 2012-07-07 13:39:51<-- SoupEvil has quit irc
- 2012-07-07 13:40:01--> SoupEvil ([email protected]) has joined
- --
- 2012-07-07 13:45:41--> hajimehoshi ([email protected]) has joined
- 2012-07-07 13:46:07--> siracusa (~siracusa@unaffiliated/siracusa) has joined
- 2012-07-07 13:46:34<eikke> shirt, favonia: I tend to think about functors as modules which take a module as an argument and return a module
- 2012-07-07 13:47:03<-- SoupEvil has quit irc
- 2012-07-07 13:47:13--> gab1one ([email protected]) has joined
- 2012-07-07 13:47:16<-- agumonkey has quit irc
- 2012-07-07 13:47:26<-- Apocalisp has quit irc
- 2012-07-07 13:47:26--> SoupEvil ([email protected]) has joined
- 2012-07-07 13:47:29<Lajla> eikke, on pala koiraa silmц╓kuopassani , apua.
- 2012-07-07 13:47:38<-- twanvl has quit irc
- 2012-07-07 13:47:47--> CSWookie ([email protected]) has joined
- 2012-07-07 13:47:49<Lajla> En voi nц╓ke
- 2012-07-07 13:48:08<eikke> shirt, favonia: you might be interested in this presentation me and a colleague gave to some students of an FP class, using Haskell, including an introduction to OCaml @ http://blog.incubaid.com/2011/12/15/guest-lecture-real-world-functional-programming-incubaid/
- 2012-07-07 13:48:22<eikke> Lajla: que? you're not speaking my language :)
- 2012-07-07 13:48:31<Lajla> Lajla, oh, I thought you were Finnish.
- 2012-07-07 13:48:33--> saep ([email protected]) has joined
- 2012-07-07 13:48:33<-- SoupEvil has quit irc
- 2012-07-07 13:48:34<Lajla> Well, tough luck.
- 2012-07-07 13:48:42<favonia> eikke: that's basically right. by the way functors in standard ml is generative (different from ocaml), so they're not strictly speaking a function in my opinion...
- 2012-07-07 13:49:03--> SoupEvil ([email protected]) has joined
- 2012-07-07 13:49:06<eikke> favonia: never worked with sml :)
- --
- 2012-07-07 13:49:40<favonia> there shold be a rosetta stone somewhere
- 2012-07-07 13:49:43<-- hajimehoshi has quit irc
- 2012-07-07 13:50:38--> agumonkey ([email protected]) has joined
- 2012-07-07 13:51:49<ski> shirt : also see rossberg's <http://www.mpi-sws.org/~rossberg/sml-vs-ocaml.html>
- 2012-07-07 13:52:08--> SoupEvil ([email protected]) has joined
- 2012-07-07 13:52:41<-- realitygrill has quit irc
- 2012-07-07 13:53:14--> gnuvince ([email protected]) has joined
- 2012-07-07 13:53:30<-- mewalz has quit irc
- 2012-07-07 13:55:08<-- bishopplox has quit irc
- 2012-07-07 13:55:08<-- narasim_7 has quit irc
- 2012-07-07 13:55:23<CSWookie> I'm having difficulty indenting my program correctly. If I paste it, would someone correct it for me? It's only 3 lines long.
- 2012-07-07 13:55:52<rwbarton> @where hpaste
- 2012-07-07 13:55:52<lambdabot> http://hpaste.org/
- 2012-07-07 13:56:02--> TheLemonMan ([email protected]) has joined
- 2012-07-07 13:56:13<-- gab1one has quit irc
- 2012-07-07 13:56:18--> happy4crazy ([email protected]) has joined
- 2012-07-07 13:56:41<hpaste> CSWookie pasted Б─°euler1.hsБ─² at http://hpaste.org/71044
- 2012-07-07 13:56:57--> bishopplox ([email protected]) has joined
- 2012-07-07 13:57:34<mcstar> bit too much parens there
- 2012-07-07 13:58:04<rwbarton> you can't just write an expression at the top level of a .hs file, assign it to a name or write "main = print $ sum ..."
- 2012-07-07 13:58:17<ion> That looks like lisp.
- 2012-07-07 13:58:24<ppilate> hah
- 2012-07-07 13:58:24<-- Ptival has quit irc
- 2012-07-07 13:58:38--> twanvl ([email protected]) has joined
- 2012-07-07 13:58:43<morel> CSWookie: you're mixing up filter and takeWhile, i think.
- 2012-07-07 13:58:52--> mewalz ([email protected]) has joined
- 2012-07-07 13:58:59<morel> > filter even [1..10]
- 2012-07-07 13:59:00<favonia> eikke, shirt: by the way I really dislike the uncurried std lib in ML... Haskell's curried std lib is cuter :D
- 2012-07-07 13:59:01<lambdabot> [2,4,6,8,10]
- 2012-07-07 13:59:05<-- timthelion has quit irc
- 2012-07-07 13:59:06<morel> > takeWhile even [1..10]
- 2012-07-07 13:59:07<lambdabot> []
- 2012-07-07 13:59:12--> Ptival (~Ptival@2a01:e35:2f61:c510:b9ac:6573:733:7e1a) has joined
- 2012-07-07 13:59:24<mcstar> no, takewhile is ok
- 2012-07-07 13:59:36<morel> mcstar: oh.
- --
- 2012-07-07 14:00:58<mroman> > (enumFromTo 65 97) :: [Char]
- 2012-07-07 14:00:58<-- twanvl_ has quit irc
- 2012-07-07 14:00:59<lambdabot> No instance for (GHC.Num.Num GHC.Types.Char)
- 2012-07-07 14:00:59<lambdabot> arising from the literal `6...
- 2012-07-07 14:02:05<mcstar> > sum [n | n <- [1..999] , mod n 3 == 0 || mod n 5 == 0]
- 2012-07-07 14:02:07<lambdabot> 233168
- 2012-07-07 14:02:10<mroman> > enumFromTo 'a' 'z'
- 2012-07-07 14:02:11<lambdabot> "abcdefghijklmnopqrstuvwxyz"
- 2012-07-07 14:02:14<mroman> ah.
- 2012-07-07 14:02:15<mroman> that way
- 2012-07-07 14:02:17<CSWookie> morel: I wanted the first 1000 elements of the list. That's takeWhile, right
- 2012-07-07 14:02:25<mcstar> CSWookie: ^^
- 2012-07-07 14:02:31--> jfredett ([email protected]) has joined
- 2012-07-07 14:02:39<rwbarton> CSWookie's program is also fine
- 2012-07-07 14:02:44<morel> mcstar: then it's fine.
- 2012-07-07 14:02:54--> gab1one ([email protected]) has joined
- 2012-07-07 14:03:05<DMcGill> I mean the storage type, for example enumFromTo :: Storage s => a -> a -> s a
- 2012-07-07 14:03:06<mcstar> semantically it is
- 2012-07-07 14:03:08<rwbarton> not as efficient I suppose
- 2012-07-07 14:03:15<DMcGill> so enumFromTo 3 5 :: Set Int
- 2012-07-07 14:03:17* hackagebot haxr 3000.9 - XML-RPC client and server library. http://hackage.haskell.org/package/haxr-3000.9 (BrentYorgey)
- 2012-07-07 14:03:19* hackagebot haxr 3000.9.0.1 - XML-RPC client and server library. http://hackage.haskell.org/package/haxr-3000.9.0.1 (BrentYorgey)
- 2012-07-07 14:03:19<DMcGill> for example
- 2012-07-07 14:03:41--> asflierl ([email protected]) has joined
- 2012-07-07 14:03:47<mroman> Ah.
- 2012-07-07 14:03:54<mroman> enumFromTo with other types instead of just lists.
- 2012-07-07 14:03:56<DMcGill> although I suppose these types usually have a fromList function
- 2012-07-07 14:04:02--> niloc132 ([email protected]) has joined
- 2012-07-07 14:04:05<DMcGill> so you'd just end up doing fromList [x..]
- 2012-07-07 14:04:20--> twanvl_ ([email protected]) has joined
- 2012-07-07 14:04:25<CSWookie> mcstar: I like that better, but in future problems I'll be doing much larger sets. Would modulo slow things down?
- 2012-07-07 14:04:41<-- SoupEvil has quit irc
- 2012-07-07 14:04:52--> SoupEvil ([email protected]) has joined
- 2012-07-07 14:05:20<-- Vorpal has quit irc
- 2012-07-07 14:05:38<mcstar> union would slow things down
- 2012-07-07 14:06:03<mcstar> and why travel the same numbers twice, when you can do it in one pass?
- 2012-07-07 14:06:26<mcstar> (well, not same numbers.. but you get the idea)
- 2012-07-07 14:06:40<-- flixil has quit irc
- 2012-07-07 14:06:46<-- fgomez has quit irc
- 2012-07-07 14:07:07--> Adeon ([email protected]) has joined
- 2012-07-07 14:07:11<fmap> CSWookie: you can use `rem' instead of `mod' if you don't need sign checks
- 2012-07-07 14:07:17<fmap> > sum [n | n <- [1..999] , n `rem` 3 == 0 || n `rem` 5 == 0]
- 2012-07-07 14:07:18<lambdabot> 233168
- 2012-07-07 14:07:52<CSWookie> Well, under the covers, a mod does lots of division.
- 2012-07-07 14:07:54<-- twanvl has quit irc
- 2012-07-07 14:08:00<mcstar> CSWookie: if you really need to do union on large lists of numbers, which might be unsorted, you should use a set based on trees
- 2012-07-07 14:08:05-!- gusto_ is now known as gusto
- 2012-07-07 14:08:43<CSWookie> So I figured the map would be faster. I imagine the compiler optimises its operators, though.
- 2012-07-07 14:09:20--> roy_ ([email protected]) has joined
- 2012-07-07 14:09:52<-- dschoepe has quit irc
- 2012-07-07 14:10:53<mcstar> > sum $ nub ([3,6..999] ++ [5,10..999])
- 2012-07-07 14:10:55<lambdabot> 233168
- 2012-07-07 14:11:28--> noor_ ([email protected]) has joined
- 2012-07-07 14:11:32--> allsystemsarego (~allsystem@unaffiliated/allsystemsarego) has joined
- 2012-07-07 14:12:45<morel> fmap: is rem faster than mod?
- 2012-07-07 14:12:59<sipa> @src rem
- 2012-07-07 14:12:59<lambdabot> Source not found. I am sorry.
- 2012-07-07 14:13:08<-- coeus has quit irc
- --
- 2012-07-07 14:16:40<hpaste> zz pasted Б─°zzБ─² at http://hpaste.org/71046
- 2012-07-07 14:16:52<-- homie has quit irc
- 2012-07-07 14:16:52--> strmpnk ([email protected]) has joined
- 2012-07-07 14:16:56--> applicative (47b6b243@gateway/web/freenode/ip.71.182.178.67) has joined
- 2012-07-07 14:17:01--> azaq23 (~derivecto@unaffiliated/azaq23) has joined
- 2012-07-07 14:17:04--> derekv ([email protected]) has joined
- 2012-07-07 14:17:30<-- happy4crazy has quit irc
- 2012-07-07 14:17:37<hpaste> mroman annotated Б─°zzБ─² with Б─°zz (annotation)Б─² at http://hpaste.org/71046#a71047
- 2012-07-07 14:17:47<rwbarton> pattern match lines for the same function have to be contiguous
- 2012-07-07 14:17:51--> timthelion ([email protected]) has joined
- 2012-07-07 14:17:52<mcstar> CSWookie: probably this is the most efficient:
- 2012-07-07 14:17:56<mcstar> > let f [] ys = ys; f xs [] = xs; f (x:xs) (y:ys) = if x==y then x : f xs ys else if x<y then x : f xs (y:ys) else y : f (x:xs) ys in sum $ f [3,6..999] [5,10..999]
- 2012-07-07 14:17:57<lambdabot> 233168
- 2012-07-07 14:18:20--> roconnor_ ([email protected]) has joined
- 2012-07-07 14:18:34<-- iocor has quit irc
- 2012-07-07 14:18:35<mcstar> > let f [] ys = ys; f xs [] = xs; f xs'@(x:xs) ys'@(y:ys) = if x==y then x : f xs ys else if x<y then x : f xs ys' else y : f xs' ys in sum $ f [3,6..999] [5,10..999]
- 2012-07-07 14:18:36<lambdabot> 233168
- 2012-07-07 14:18:47<mcstar> to prevent some unncesesary destructuring
- 2012-07-07 14:18:48--> Cale ([email protected]) has joined
- 2012-07-07 14:18:56--> vlprans ([email protected]) has joined
- 2012-07-07 14:18:58<allsystemsarego> ok, let me try this and come back
- 2012-07-07 14:19:00<mcstar> unnecessary that is
- 2012-07-07 14:19:04<-- roconnor has quit irc
- 2012-07-07 14:20:16<-- Irfan_A has left
- 2012-07-07 14:20:20<-- CSWookie has quit irc
- 2012-07-07 14:20:25<mroman> allsystemsarego: but...
- 2012-07-07 14:20:26<mroman> :t max
- 2012-07-07 14:20:28<lambdabot> forall a. (Ord a) => a -> a -> a
- 2012-07-07 14:20:39<mroman> :t (+)
- 2012-07-07 14:20:40<lambdabot> forall a. (Num a) => a -> a -> a
- 2012-07-07 14:20:55<mroman> Just Ord a won't do it.
- 2012-07-07 14:21:18--> homie ([email protected]) has joined
- 2012-07-07 14:21:36<raymank26> hi all. I trying to use gtk2hs with glade and I faced with a problem as in the thread http://comments.gmane.org/gmane.comp.lang.haskell.gtk2hs/1081 But my packages are up to date. What can I do to fix this?
- 2012-07-07 14:22:07<allsystemsarego> I'm still struggling to understand the type system, I probably won't know how to fix that
- 2012-07-07 14:22:20<allsystemsarego> but thanks
- 2012-07-07 14:22:32--> path[l]_ ([email protected]) has joined
- 2012-07-07 14:22:39<-- RoXtein has quit irc
- 2012-07-07 14:22:53<morel> allsystemsarego: you could just remove the type signature, load it in ghci and then display the type.
- 2012-07-07 14:23:13<-- AfC has quit irc
- 2012-07-07 14:23:18--> AfC1 ([email protected]) has joined
- 2012-07-07 14:23:19<hpaste> morel annotated Б─°zzБ─² with Б─°zz with NumБ─² at http://hpaste.org/71046#a71048
- 2012-07-07 14:23:32<-- phischu has quit irc
- 2012-07-07 14:23:53<-- strmpnk has quit irc
- 2012-07-07 14:24:19--> twanvl ([email protected]) has joined
- 2012-07-07 14:24:24--> CSWookie ([email protected]) has joined
- 2012-07-07 14:25:05<allsystemsarego> morel, mroman - thanks, that works
- 2012-07-07 14:25:08<-- timthelion has quit irc
- 2012-07-07 14:25:17<CSWookie> Sorry about that, folks. My computer pooped out.
- 2012-07-07 14:25:24<-- path[l] has quit irc
- 2012-07-07 14:25:25-!- path[l]_ is now known as path[l]
- 2012-07-07 14:25:26--> jianmeng ([email protected]) has joined
- 2012-07-07 14:25:51--> strmpnk ([email protected]) has joined
- 2012-07-07 14:25:51<mcstar> CSWookie: what was the last thing you saw?
- 2012-07-07 14:25:54<-- isomorphic has quit irc
- 2012-07-07 14:26:35<CSWookie> Something involving ++
- 2012-07-07 14:26:37<-- gnuvince has quit irc
- 2012-07-07 14:26:38<-- Cale has quit irc
- 2012-07-07 14:26:40--> PhilRod ([email protected]) has joined
- 2012-07-07 14:26:56<mcstar> CSWookie: shall i paste it again?
- 2012-07-07 14:27:03<CSWookie> Please.
- 2012-07-07 14:27:07<-- copumpkin has quit irc
- 2012-07-07 14:27:12<-- voodster has quit irc
- 2012-07-07 14:27:13<-- phyrex1an has quit irc
- 2012-07-07 14:27:42<-- twanvl_ has quit irc
- 2012-07-07 14:28:04<-- importantshock has quit irc
- 2012-07-07 14:28:31--> copumpkin (~copumpkin@unaffiliated/copumpkin) has joined
- 2012-07-07 14:28:41<hpaste> mcstar pasted Б─°PE1Б─² at http://hpaste.org/71049
- 2012-07-07 14:28:49--> HugoDaniel ([email protected]) has joined
- 2012-07-07 14:29:04<CSWookie> I'm getting errors like: No instance for (Integral (IO a))
- 2012-07-07 14:29:05<mcstar> CSWookie: probably the last one is the most efficient
- 2012-07-07 14:30:08<-- strmpnk has quit irc
- 2012-07-07 14:32:00--> skchrko ([email protected]) has joined
- 2012-07-07 14:32:20<CSWookie> Can you walk me through what's going on there?
- 2012-07-07 14:32:42--> timthelion ([email protected]) has joined
- 2012-07-07 14:32:56<CSWookie> I've got tutorials, even a book, but all the ys's and xs's get me turned around
- 2012-07-07 14:33:06<-- eikke has quit irc
- 2012-07-07 14:33:08<CSWookie> I'm used to longer variable names.
- 2012-07-07 14:33:18<mcstar> CSWookie: since the input lists are sorted in increasing order, i take the minimum of the heads of the two lists
- 2012-07-07 14:33:21<rwbarton> f at least should have a real name like merge
- 2012-07-07 14:33:23--> anRch ([email protected]) has joined
- 2012-07-07 14:33:49<mcstar> if they are the same, i.e. both are a multiple of 3 and 5 i only add it once to the resulting list
- 2012-07-07 14:34:10<mcstar> rwbarton: thanks for your input
- 2012-07-07 14:34:31<mcstar> f stands for function, and it is quite real
- 2012-07-07 14:34:51--> eikke ([email protected]) has joined
- 2012-07-07 14:35:30<mcstar> CSWookie: ofc, it is not necessary to construct a list, you could sum the numbers from the function 'f'
- 2012-07-07 14:36:09<dmwit> if | -- ?
- 2012-07-07 14:36:31<mcstar> dmwit: copied from weechat
- 2012-07-07 14:36:47<CSWookie> Man, these operators have me at a loss.
- 2012-07-07 14:36:56<mcstar> (the panel with the nicks are separated by | characters)
- 2012-07-07 14:37:27<CSWookie> Is there a list of operators and what they do?
- 2012-07-07 14:37:31<hpaste> mcstar annotated Б─°PE1Б─² with Б─°PE1 (annotation)Б─² at http://hpaste.org/71049#a71050
- 2012-07-07 14:37:39<dmwit> Can f just be map head . group . sort?
- 2012-07-07 14:38:03<mcstar> dmwit: i didnt want to use sort, since the lists are sorted
- 2012-07-07 14:38:07<dmwit> That would be nice, since then the whole function is just sum . map head . group . sort, which is a one-liner, and pretty readable, too.
- 2012-07-07 14:38:19<dmwit> They're not sorted after you concatenate them. =)
- 2012-07-07 14:38:46<mcstar> dmwit: i dont concatenate them
- 2012-07-07 14:38:50<hpc> or somewhat shorter, sum . nub . sort
- 2012-07-07 14:38:54<hpaste> b52 annotated Б─°PE1Б─² with Б─°PE1 (annotation)Б─² at http://hpaste.org/71049#a71051
- 2012-07-07 14:38:59<b52> gni hi :D
- 2012-07-07 14:39:00<hpc> > nub [1,1,2,3,2]
- --
- 2012-07-07 14:41:22<dmwit> Depending on whether you're into that kind of thing, I guess http://hackage.haskell.org/packages/archive/data-ordlist/0.4.5/doc/html/Data-List-Ordered.html counts.
- 2012-07-07 14:41:55--> orn ([email protected]) has joined
- 2012-07-07 14:42:08<dmwit> Which offers both merge and union. So that's nice.
- 2012-07-07 14:42:12<Franciman> hey guys, behind ST monad there is C code or is it all haskell?
- 2012-07-07 14:42:32<mcstar> @hoogle a -> [a] -> [[a]]
- 2012-07-07 14:42:32<lambdabot> Data.List intersperse :: a -> [a] -> [a]
- 2012-07-07 14:42:32<lambdabot> Data.List insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]
- 2012-07-07 14:42:32<lambdabot> Data.List deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]
- 2012-07-07 14:42:43<merijn> Franciman: ST is all haskell
- 2012-07-07 14:42:43<Franciman> I mean how does for example STArray change its values?
- 2012-07-07 14:42:44<dmwit> CSWookie: ?hoogle will tell you the type of an operator; the online version of Hoogle will also link to documentation and source.
- 2012-07-07 14:42:52<merijn> Franciman: As far as I know, anyway
- 2012-07-07 14:43:08<mcstar> dmwit: i dont see a function in Data.List.Ordered with the above signature
- 2012-07-07 14:43:13<CSWookie> ?hoogle '
- 2012-07-07 14:43:13<lambdabot> Parse error:
- 2012-07-07 14:43:13<lambdabot> '
- 2012-07-07 14:43:13<lambdabot> ^
- 2012-07-07 14:43:19<CSWookie> ?hoogle @
- 2012-07-07 14:43:20<lambdabot> keyword
- 2012-07-07 14:43:20<lambdabot> Test.HUnit.Base (
- 2012-07-07 14:43:20<lambdabot> Test.HUnit.Base (
- 2012-07-07 14:43:35<dmwit> mcstar: What is the function supposed to do? That's a weird type.
- 2012-07-07 14:43:42<MostAwesomeDude> Franciman: Well, ST is directly built on IO. You can go read the code but it's not very enlightening.
- 2012-07-07 14:44:02<dmwit> mcstar: Oh, yeah, Data.List.Ordered of course doesn't offer that. What does that have to do with ordered lists?
- 2012-07-07 14:44:11<sipa> MostAwesomeDude: isn't it the other way really, implementation-wise?
- 2012-07-07 14:44:14<mcstar> f 1 [2,3,4] => [[1,2,3,4], [2,1,3,4], [2,3,1,4]...
- 2012-07-07 14:44:15<Franciman> MostAwesomeDude, and in turn, is IO all the way haskell?
- 2012-07-07 14:44:17--> derekv ([email protected]) has joined
- --
- 2012-07-07 15:07:18<lambdabot> [1,2,3,4,5,6,7,8,9,10]
- 2012-07-07 15:07:19<lambdabot> [2,4,6,8,10]
- 2012-07-07 15:07:34<mroman> i see.
- 2012-07-07 15:07:36<dmwit> > enumFromThen 2 2
- 2012-07-07 15:07:37<lambdabot> [2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,...
- 2012-07-07 15:07:38<-- drmegahertz has quit irc
- 2012-07-07 15:07:38<shreyash> ohk thanks :-)
- 2012-07-07 15:07:39<mroman> thx.
- 2012-07-07 15:07:40<dmwit> > enumFromThen 2 4
- 2012-07-07 15:07:40<lambdabot> [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,...
- 2012-07-07 15:07:44<CSWookie> Alright guys. I can't even get :load euler1.hs to load when all it says is 'main = 6'
- 2012-07-07 15:07:56<mroman> CSWookie: 6 is not IO
- 2012-07-07 15:07:57<dmwit> CSWookie: 6 is not an IO action.
- 2012-07-07 15:08:00<DMcGill> is the IO monad strict?
- 2012-07-07 15:08:04<dmwit> CSWookie: Perhaps you might like main = print 6
- 2012-07-07 15:08:05<mroman> No.
- 2012-07-07 15:08:18<dmwit> DMcGill: Tricky question.
- 2012-07-07 15:08:20<-- silver has quit irc
- 2012-07-07 15:08:23<DMcGill> I'm getting an error "cannot delete file, in use"
- 2012-07-07 15:08:28<DMcGill> in the code I read a file and then try to delete it
- 2012-07-07 15:08:33<dmwit> DMcGill: An IO a action is not strict in the a part.
- 2012-07-07 15:08:37<CSWookie> Husah!
- 2012-07-07 15:08:40<mcstar> have you closed it?
- 2012-07-07 15:08:40<mroman> DMcGill: Then lazyness kicks your ass ;)
- 2012-07-07 15:08:42<dmwit> DMcGill: Perhaps you forgot to close the handle after you read from the file.
- 2012-07-07 15:08:43<XexonixXexillion> DMcGill: did you use getContents or something similar?
- 2012-07-07 15:08:45<mroman> lazy reading a file locks it.
- 2012-07-07 15:08:45<DMcGill> would forcing the result of that evaluation before deleting it help?
- 2012-07-07 15:08:51<maybefbi> shreyash, in non-lazy languages if you try to implement if as a function, it will always evaluate both arguments to the function
- 2012-07-07 15:08:55<-- shreyash has left
- 2012-07-07 15:08:59<dmwit> DMcGill: Also, get a real operating system. ;-)
- 2012-07-07 15:09:04<DMcGill> I wasn't using handles, I guess I have to start?
- 2012-07-07 15:09:09<mcstar> shreyash: you will love haskell, give it a try!
- 2012-07-07 15:09:12--> ISF ([email protected]) has joined
- 2012-07-07 15:09:14<mroman> There is System.IO.Strict
- 2012-07-07 15:09:19<mroman> which has a strict version of readFile.
- 2012-07-07 15:09:22<dmwit> DMcGill: You can use the "strict" package
- 2012-07-07 15:09:24<danr> but it must surely be enough to read to eof
- 2012-07-07 15:09:24--> t7 ([email protected]) has joined
- 2012-07-07 15:09:24<dmwit> ?hackage strict
- 2012-07-07 15:09:25<lambdabot> http://hackage.haskell.org/package/strict
- 2012-07-07 15:09:32<CSWookie> Yay!
- 2012-07-07 15:09:43<dmwit> danr: Yes, but "readFile" doesn't immediately read all the way to eof.
- 2012-07-07 15:09:52<dmwit> (for example)
- 2012-07-07 15:09:54--> homie ([email protected]) has joined
- 2012-07-07 15:10:37<danr> dmwit: no of course not
- 2012-07-07 15:11:10<danr> but I would presume that this works: xs <- readFile; length xs `seq` rest_of_the_program
- 2012-07-07 15:11:14<CSWookie> Now I have understanding of digital watches!k
- 2012-07-07 15:11:25<dmwit> danr: That's not totally obvious, actually.
- 2012-07-07 15:11:37<dmwit> I wouldn't be surprised if the file stayed open until the next garbage collection or something like that.
- 2012-07-07 15:12:06<\rs> dmwit: would you like to share your config?
- 2012-07-07 15:12:10<dmwit> And this is definitely a GHC thing, not a Haskell thing.
- 2012-07-07 15:12:12<danr> oh, I wouldn't have thought of GC... but I'm also getting worried that I might need to evaluate the elements as well
- 2012-07-07 15:12:12<-- Lamen has quit irc
- 2012-07-07 15:12:13<mcstar> length xs `seq` rest_of_the_program << wth is that?
- 2012-07-07 15:12:24<DMcGill> so to reiterate: just using seq won't be enough?
- 2012-07-07 15:12:28<rwbarton> I think the unsafeInterleaveIO'd action that is feeding you characters will close the file before returning []
- 2012-07-07 15:12:36<-- Ralith has quit irc
- 2012-07-07 15:12:41<dmwit> \rs: huh?
- 2012-07-07 15:12:43<rwbarton> so you aren't relying on garbage collection
- 2012-07-07 15:12:47<dmwit> rwbarton: Oh, that's nice.
- 2012-07-07 15:12:51--> Ralith ([email protected]) has joined
- 2012-07-07 15:12:58<CSWookie> mcstar: Does 'n | n <- [1..999]' mean 'n = n for the range from 1 to 999'?
- 2012-07-07 15:13:17<mcstar> CSWookie: yes
- 2012-07-07 15:13:37<mcstar> the 2 ns are the same
- 2012-07-07 15:13:47<CSWookie> So, this is a list comprehension?
- 2012-07-07 15:13:48--> newtrekemotion ([email protected]) has joined
- 2012-07-07 15:13:51<mcstar> yes
- 2012-07-07 15:13:55<CSWookie> OK.
- 2012-07-07 15:14:27<CSWookie> I know about those from Python
- 2012-07-07 15:14:37<mcstar> think of it as the part after | introduces a binding, that bind n for all of the list comprehension
- 2012-07-07 15:14:46--> cognominal_ ([email protected]) has joined
- 2012-07-07 15:14:46<-- pi8027 has left
- 2012-07-07 15:14:47--> drmegahertz ([email protected]) has joined
- 2012-07-07 15:15:02<dmwit> Yes, Python stole them wholesale from Haskell. =)
- 2012-07-07 15:15:14--> bitonic ([email protected]) has joined
- 2012-07-07 15:15:25<mroman> but python is weird
- 2012-07-07 15:15:35<CSWookie> dmwit: I know. That's why the knowledge translates so nicely.
- 2012-07-07 15:15:46<CSWookie> mroman: how so?
- 2012-07-07 15:15:56--> kallisti (~eris@wikipedia/The-Prophet-Wizard-of-the-Crayon-Cake) has joined
- 2012-07-07 15:16:14<mroman> [x for x in [1,2,3]] looks weird.
- 2012-07-07 15:16:15<mcstar> CSWookie: i think dmwit was joking
- 2012-07-07 15:16:21<mroman> but that's it :)
- 2012-07-07 15:17:30<mcstar> dont expect to get much knowledge translated from python, maybe just your problem solving experience...
- 2012-07-07 15:17:36<merijn> mcstar: Well, no. Python's list comprehensions were copied from haskell
- 2012-07-07 15:17:54<-- cognominal has quit irc
- 2012-07-07 15:17:58<mcstar> merijn: i see, haskell's still better
- 2012-07-07 15:18:00<MostAwesomeDude> Python also copied itertools.
- 2012-07-07 15:18:07<mroman> [x*y|x<-[1,2,3],y<-[1,2,3]] can't be written directly with pythons list comprehensions afaik.
- 2012-07-07 15:18:19<mcstar> mroman: double for
- 2012-07-07 15:18:28<MostAwesomeDude> mroman: [x * y for x in xs for y in ys]
- 2012-07-07 15:18:43<mroman> oh.
- --
- 2012-07-07 16:43:24<-- c_wraith has quit irc
- 2012-07-07 16:43:42<mm|swarm> any suggestion: coding style, explanations (I'm teaching someone), other solutions
- 2012-07-07 16:43:42<-- strmpnk_ has quit irc
- 2012-07-07 16:43:49<mm|swarm> basic
- 2012-07-07 16:44:22<mm|swarm> the problem was to return the maximum sum of a sub-sequence containing non-consecutive elements from a given list
- 2012-07-07 16:44:39* BMeph has a suggestion: More cowbell! ;)
- 2012-07-07 16:44:53<mm|swarm> for example for input [1,2,3,4] the code must return 6 (2 + 4)
- 2012-07-07 16:45:37<-- Cale has quit irc
- 2012-07-07 16:46:18<-- t7 has quit irc
- 2012-07-07 16:46:20<mcstar> any subsequence?
- 2012-07-07 16:46:20<-- CSWookie has quit irc
- 2012-07-07 16:46:27<dmwit> Looks inefficient.
- 2012-07-07 16:46:32<-- andares has quit irc
- 2012-07-07 16:46:38<dmwit> You might be interested in the Google search term "dynamic programming".
- 2012-07-07 16:46:55--> strmpnk ([email protected]) has joined
- 2012-07-07 16:47:03--> Cale ([email protected]) has joined
- 2012-07-07 16:47:33<mm|swarm> dmwit: of course :)
- 2012-07-07 16:47:41<mm|swarm> but the student didn't learn about it
- 2012-07-07 16:47:47<mm|swarm> it is the second step
- 2012-07-07 16:47:54<mm|swarm> (dynamic programming that is)
- 2012-07-07 16:48:09<-- pchiusano has quit irc
- 2012-07-07 16:48:16--> CSWookie ([email protected]) has joined
- 2012-07-07 16:48:30<mm|swarm> mcstar: any subsequence as long as two elements which are next to one another in the original list are not in the sum
- 2012-07-07 16:49:24<dmwit> Also the quickcheck properties don't pass here, so that's a bad sign.
- 2012-07-07 16:49:41<dmwit> propSameOriginalSecond falsifiable: [2,1,1,2]
- 2012-07-07 16:49:43<-- BlairA has quit irc
- 2012-07-07 16:50:05<dmwit> The original seems to get that wrong.
- 2012-07-07 16:50:10<BMeph> mm|swarm: Just me, but instead of 'filterM (const [True, False])' you could just use 'subsequences' - it "says what it means". :)
- 2012-07-07 16:50:26<mm|swarm> that's true, original is student work, first is with some patterns removed but the same thing and second is a brute force solution per-se
- 2012-07-07 16:50:29<dmwit> Yes, excludeHead [x,y,z] = y -- this is just wrong
- 2012-07-07 16:50:44<mm|swarm> BMeph: ah, oops, I forgot that subsequences exists :">
- 2012-07-07 16:51:01<dmwit> Generally speaking, I would say base cases which extend beyond, say, singleton lists make me squint and worry.
Advertisement
Add Comment
Please, Sign In to add comment