On Fri, Oct 20, 2006 at 06:08:26PM +0200, Henk-Jan van Tuyl wrote:
How about this:
import List
isIdentity (PL xs) = xs `isPrefixOf` [1..]
?
Great! This is so natural.
When will I finally learn to continue thinking after finding the first
solution, especially when I feel it's not ideal?!
Hallo Bulat!
On Fri, Oct 20, 2006 at 10:21:51PM +0400, Bulat Ziganshin wrote:
first, GC don't occurs automatically when you close file. you can help
GHC by using performGC from System.Mem. i does it in my own prog
I did not get an appreciable improvement with performGC, as you can
see from
On 21/10/06, Tomasz Zielonka [EMAIL PROTECTED] wrote:
Do you also have this experience with Haskell?: when you feel that
some code is not ideal, almost always it can be improved.
One of the recurring features of the #haskell IRC conversations is
something called 'Algorithm Golf' (which is a
dmhouse:
On 21/10/06, Tomasz Zielonka [EMAIL PROTECTED] wrote:
Do you also have this experience with Haskell?: when you feel that
some code is not ideal, almost always it can be improved.
One of the recurring features of the #haskell IRC conversations is
something called 'Algorithm Golf'
Hello,I have this function here: endsWith :: Eq a = [a] - [a] - Bool endsWith suffix list | lengthDifference 0 = False | otherwise = (drop lengthDifference list) == suffix
where lengthDifference = (length list) - (length suffix)Would this be the preferred function argument order? Or is the
John Ky wrote:
Hello,
I have this function here:
endsWith :: Eq a = [a] - [a] - Bool
endsWith suffix list
| lengthDifference 0 = False
| otherwise = (drop lengthDifference list) == suffix
where lengthDifference = (length list) - (length suffix)
I thinks that's what
On 10/21/06, Stephan Walter [EMAIL PROTECTED] wrote:
John Ky wrote:
Hello,
I have this function here:
endsWith :: Eq a = [a] - [a] - Bool
endsWith suffix list
| lengthDifference 0 = False
| otherwise = (drop lengthDifference list) == suffix
where lengthDifference = (length list)
Hi John,
long `endsWith` short = (reverse short) `isPrefixOf` (reverse long)
would be a possibility (and might be slightly more efficient).
And this argument order is much better according to the principle of least
surprise (a `endsWith` b is naturally interpreted so that b is the suffix).
Andrea Rossato wrote:
I did not get an appreciable improvement with performGC, as you can
see from here:
http://gorgias.mine.nu/haskell/a.out.withPerformGC.ps
But I found a solution: just write the opml state component to a file!
Obviously the values in question were not garbage, rather
Hallo!
Thanks a lot for stopping by.
On Sat, Oct 21, 2006 at 06:41:32PM +0200, Udo Stenzel wrote:
The correct solution however, is the application of 'seq' at the right
places. To understand where these are, perform a simulation of
Haskell's reduction strategy on paper.
I will definitely
On Sat, Oct 21, 2006 at 09:09:13PM +0200, Andrea Rossato wrote:
So, it's parsec, on your side...;-)
I sorry, I was a bit confused when I wrote that.
I confused you for another person, obviously.
Sorry about that. Andrea
pgpx3F8PsFdVW.pgp
Description: PGP signature
Hello Andrea,
Saturday, October 21, 2006, 3:44:31 PM, you wrote:
first, GC don't occurs automatically when you close file. you can help
GHC by using performGC from System.Mem. i does it in my own prog
But I found a solution: just write the opml state component to a file!
and just after that
12 matches
Mail list logo