[Haskell-cafe] Generic permutations

2008-01-26 Thread Cetin Sert
How can I make a generic permutations function? -- boolean permutations bpms :: Int → [[Bool]] bpms 0 = [[]] bpms n = map (False:) bss ++ map (True:) bss where bss = bpms (n - 1) -- generic permutations pms a :: Int → [[a]] Best Regards, Cetin Sert

Re: [Haskell-cafe] Re: hxt memory useage

2008-01-26 Thread Bulat Ziganshin
Hello Rene, Friday, January 25, 2008, 10:49:53 PM, you wrote: Still I am a bit surprised that you can't parse 30m with 8 gig memory. This was discussed here before, and I think someone benchmarked HXT as using roughly 50 bytes of memory per 1 byte of input. i.e. HXT would then be using

[Haskell-cafe] Re: Generic permutations

2008-01-26 Thread Cetin Sert
I have come up with this myself ^_^ mps :: [a] → [[a]] → [[a]] mps [] _ = [] mps _ [] = [] mps (x:xs) yss = map (x:) yss ++ mps xs yss pms :: [a] → Int → [[a]] pms [] _ = [[]] pms _ 0 = [[]] pms xxs n = mps xxs (pms (xxs) (n - 1)) -- now bpms can pointlessly be redefined as bpms

Re: [Haskell-cafe] hxt memory useage

2008-01-26 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes: So this is a request for an xml-light based on lazy bytestrings, designed for speed at all costs? Yes, I suppose it is. (For certain values of all costs.) For industrial use, I think it is important to have better performance, ideally approaching disk

The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Paul Johnson
Evan Laforge wrote: Java's just wordy like that. In python you'd say max(foos, key=lambda x: x.update_time). While this is true, I was also thinking of the typical audience SPJ specified: senior technical people and managers. Most of these people have heard of Python and Ruby, but see

Re: [Haskell-cafe] hxt memory useage

2008-01-26 Thread Keith Fahlgren
On 1/26/08 3:43 AM, Ketil Malde wrote: I think a good approach would be a TagSoup-like (SAX-like) lazy ByteString parser, with more advanced features (checking for well-formedness, building a tree structure, validation, namespace support..) layered on top. Perhaps a more modern approach

[Haskell-cafe] Re: HList error with hFoldr

2008-01-26 Thread Denis Bueno
On Sat, Jan 26, 2008 at 1:59 AM, [EMAIL PROTECTED] wrote: [snip useful explanation of error} Here's a bit elaborated example: [...] Thanks! this works, and I understand why it didn't before. The example I posted was a stepping stone toward a definition of distance using hFoldr and hZip.

[Haskell-cafe] Problem with HGL

2008-01-26 Thread jia wang
Hi, I'm trying to use HGL-3.2.0.0 with ghc-6.8.2 on my windows system. When I run command: runhaskell Setup.hs build it shows an error D:\HGL-3.2.0.0\HGL-3.2.0.0runhaskell Setup.hs build Preprocessing library HGL-3.2.0.0... Building HGL-3.2.0.0... Graphics/HGL/Key.hs:57:7: Could not

Re: [Haskell-cafe] Problem with HGL

2008-01-26 Thread Jake McArthur
On Jan 26, 2008, at 12:20 PM, jia wang wrote: Graphics/HGL/Key.hs:57:7: Could not find module `Graphics.Win32': it is a member of package Win32-2.1.1.0, which is hidden You need to install the Win32 package. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Win32-2.1.0.0 -

[Haskell-cafe] Re: HList error with hFoldr

2008-01-26 Thread Denis Bueno
On Sat, Jan 26, 2008 at 11:03 AM, Denis Bueno [EMAIL PROTECTED] wrote: Have I made some sort of simple error, or am I going about this the wrong way altogether? After some fooling around, I came up with something I think makes sense. Let me know if this is the right/wrong thing. It seems to

Re: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Tim Chevalier
On 1/26/08, Paul Johnson [EMAIL PROTECTED] wrote: * Say computers are cheap but programmers are expensive whenever explaining a correctness or productivity feature. This is true only if talking to people in high-income nations. Cheers, Tim -- Tim Chevalier * http://cs.pdx.edu/~tjc

Re: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Paul Johnson
Tim Chevalier wrote: On 1/26/08, Paul Johnson [EMAIL PROTECTED] wrote: * Say computers are cheap but programmers are expensive whenever explaining a correctness or productivity feature. This is true only if talking to people in high-income nations. Even in low-income

Re: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Tim Chevalier
On 1/26/08, Paul Johnson [EMAIL PROTECTED] wrote: Tim Chevalier wrote: This is true only if talking to people in high-income nations. Even in low-income nations, its only false in the short term. If you have skilled programmers with computers and Internet connections then their wages

Re: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread jerzy . karczmarczuk
Tim Chevalier/Paul Johnson about cheap computers, expensive programmers This is true only if talking to people in high-income nations. Even in low-income nations, its only false in the short term. If you have skilled programmers with computers and Internet connections then their wages

Re: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Dipankar Ray
Jerzy, this is a very interesting point you bring up, from my perspective. I should point out that certain US-trained mathematicans (myself included) are actually quite jealous of the Russian math education system - they produce mathematicians who tend to be excellent in depth and breadth,

[Haskell-cafe] Re: The programming language market

2008-01-26 Thread Artem V. Andreev
[EMAIL PROTECTED] writes: Tim Chevalier/Paul Johnson about cheap computers, expensive programmers This is true only if talking to people in high-income nations. Even in low-income nations, its only false in the short term. If you have skilled programmers with computers and Internet

Re: [Haskell-cafe] Re: Generic permutations

2008-01-26 Thread Ryan Ingram
When you say permuations, I think of reorderings of a list, for example: permutations [1,2,3] = [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] Here's an implementation: -- split [1,2,3] = [ --( 1, [2,3] ), --( 2, [1,3] ), --( 3, [1,2] ) ] split :: [a] - [(a,

[Haskell-cafe] Re: The programming language market (was Re: Why functional programming matters

2008-01-26 Thread Stefan Monnier
* Say computers are cheap but programmers are expensive whenever explaining a correctness or productivity feature. This is true only if talking to people in high-income nations. Is it? Maybe you're right. But historically, computers have been available at all kinds of price ranges, so people

Re: [Haskell-cafe] Re: Generic permutations

2008-01-26 Thread Cetin Sert
Thank you very much ^_^. What would be a mathematically correct and understandable name for what we call 'pms' here? And in what module do foldM, combine, replicate, rest, liftM and so on reside? How can I import them? o_O -- Cetin Sert On 26/01/2008, Ryan Ingram [EMAIL PROTECTED] wrote:

Re: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread jerzy . karczmarczuk
Dipankar Ray writes: I should point out that certain US-trained mathematicans (myself included) are actually quite jealous of the Russian math education system - they produce mathematicians who tend to be excellent... Anyway, no we're older, and we realize that it would have helped our math

Re: [Haskell-cafe] Re: The programming language market (was Re: Why functional programming matters

2008-01-26 Thread Tim Chevalier
On 1/26/08, Stefan Monnier [EMAIL PROTECTED] wrote: * Say computers are cheap but programmers are expensive whenever explaining a correctness or productivity feature. This is true only if talking to people in high-income nations. Is it? Maybe you're right. Yes -- consider the OLPC

Re: [Haskell-cafe] Re: Generic permutations with high performance

2008-01-26 Thread Cetin Sert
Hello again Ryan, I have found out where to import those stuff from and tested your more elegant suggestion and my original performance. -- print ((length ∘ pmsO [0,1]) 24) 9~ seconds -- print ((length ∘ pmsE [0,1]) 24) 23~ seconds -- print ((length ∘ pmsU [0,1]) 24) 23~ seconds --

Re: [Haskell-cafe] Re: Generic permutations

2008-01-26 Thread Cetin Sert
Hello again Ryan, I have found out where to import those stuff from and tested your more elegant suggestion and my original performance. -- print ((length ∘ pmsO [0,1]) 24) 9~ seconds -- print ((length ∘ pmsE [0,1]) 24) 23~ seconds -- print ((length ∘ pmsU [0,1]) 24) 23~ seconds --

Re: [Haskell-cafe] Re: Generic permutations

2008-01-26 Thread Jed Brown
On 26 Jan 2008, [EMAIL PROTECTED] wrote: The problem you solved can be solved much more elegantly: pms : [a] - Int - [[a]] pms xs n = foldM combine [] (replicate n xs) where combine rest as = liftM (:rest) as or, for the unreadable version: pms xs n = foldM (map . flip (:)) [] $ replicate

Re: [Haskell-cafe] Re: Generic permutations

2008-01-26 Thread Cetin Sert
Thanks Jed, replicateM is almost as performant as pms on my pc (+ 2~ seconds). That's a killer suggestion... thank you very much ^_^ --Cetin Sert On 27/01/2008, Jed Brown [EMAIL PROTECTED] wrote: The problem you solved can be solved much more elegantly: pms : [a] - Int - [[a]] pms xs

Re: [Haskell-cafe] hxt memory useage

2008-01-26 Thread Matthew Pocock
On Saturday 26 January 2008, Keith Fahlgren wrote: Perhaps a more modern approach would be StAX[1]-like rather than SAX-like? In either case, streaming, non-DOM. I am concerned by the number of people expressing willingness to abandon namespace support, but perhaps I'm being too much of a

Re: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Artem V. Andreev
[EMAIL PROTECTED] writes: And, PLEASE, Artem V. Andreev, before you say plainly again that I am definitely wrong. I didn't invent what I say, and I hope nobody can accuse me of any inimical thoughts against Russians. I had not the slightest intention to accuse you of anything. Nor did I want

Re: [Haskell] Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Isaac Dupree
Michael Reid wrote: The power of Haskell's type system makes it feel like you are programming in a dynamic language to some degree, yet all of it is type-checked, and that is just *really* cool. to some degree, (in current Haskell compilers), it *is* more like a dynamic than a static

Re: [Haskell] Re: [Haskell-cafe] Why functional programming matters

2008-01-26 Thread Isaac Dupree
Derek Elkins wrote: On Sat, 2008-01-26 at 20:49 -0500, Isaac Dupree wrote: Michael Reid wrote: The power of Haskell's type system makes it feel like you are programming in a dynamic language to some degree, yet all of it is type-checked, and that is just *really* cool. to some degree, (in

[Haskell-cafe] ANN: HStringTemplate 0.2

2008-01-26 Thread Sterling Clover
HStringTemplate is a general purpose templating system, geared especially towards HTML and based on Terrence Parr’s Java library. On Hackage at: http://hackage.haskell.org/cgi-bin/hackage-scripts/ package/HStringTemplate-0.2 Development version at: darcs get http://code.haskell.org/

[Haskell-cafe] Enterprise Haskell AMQP library initial start and would like to pass it off to someone.

2008-01-26 Thread Berlin Brown
I started a AMQP library; there really isn't a lot there but at least I was able to connect to the server. Here is the code and hopefully someone else can continue with the project. The AMQP protocol is moderately complex. HTTP is simple and stuff like RMI, JMS, Database Protocols are really

[Haskell-cafe] Testing one's .ghci

2008-01-26 Thread gwern0
So I was recently going over my config files (which are version-controlled in Darcs, of course), and I was adding tests for recording patches. For some of the files, it was easy enough - the application generally provided some mean of loading in the rc file and then it would error or not based