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
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
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
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
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
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
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.
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
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
-
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
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
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
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
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
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,
[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
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,
* 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
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:
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
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
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
--
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
--
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
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
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
[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
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
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
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/
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
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
32 matches
Mail list logo