ivial thing for people knowing Haskell
|
| Udo Stenzel <[EMAIL PROTECTED]> writes:
|
| >> Friedrich wrote:
| >> >Ok to be more concrete is the laziness "hidden" here?
| >> >
| >> >check_line line sum count =
| >> >le
Udo Stenzel <[EMAIL PROTECTED]> writes:
>> Friedrich wrote:
>> >Ok to be more concrete is the laziness "hidden" here?
>> >
>> >check_line line sum count =
>> >let match = matchRegex regexp line
>> >in case match of
>> > Just strs -> (sum + read (head strs) :: Integer,
Udo Stenzel <[EMAIL PROTECTED]> writes:
>> Friedrich wrote:
>> >Ok to be more concrete is the laziness "hidden" here?
>> >
>> >check_line line sum count =
>> >let match = matchRegex regexp line
>> >in case match of
>> > Just strs -> (sum + read (head strs) :: Integer,
Thanks, I just figured out that I run out of file descriptors with
reading them all at once. But I probably can try the countDownloads
function. We'll see how that works.
Regards
Friedrich
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell
Friedrich wrote:
> Taral <[EMAIL PROTECTED]> writes:
> > Wow, talk about doing everything by hand. :) There are a lot of
> > utility functions that make your life easier. Try this:
Given a strict pair, it should work:
> > import Control.Monad
> > import Data.Char
> > import Data.List
> > import S
> Friedrich wrote:
> >Ok to be more concrete is the laziness "hidden" here?
> >
> >check_line line sum count =
> >let match = matchRegex regexp line
> >in case match of
> > Just strs -> (sum + read (head strs) :: Integer, count + 1)
> > Nothing -> (sum, co
I think it might be more appropriate to move this discussion to
haskell-cafe.
On 19 okt 2008, at 17:24, Friedrich wrote:
Learn to love types: one of the neat things about Haskell is that if
you can write down the type of a function then you have usually done
90% of the work of writing the cod
Taral <[EMAIL PROTECTED]> writes:
> On Sat, Oct 18, 2008 at 1:50 AM, Friedrich
> <[EMAIL PROTECTED]> wrote:
>> I've written just a few programs in Haskell one in a comparison for a
>> task I had "nearly daily".
>>
>> The code analyzes Apache logs and picks some certain stuff from it and
>> after t
Friedrich wrote:
Ok to be more concrete is the laziness "hidden" here?
check_line line sum count =
let match = matchRegex regexp line
in case match of
Just strs -> (sum + read (head strs) :: Integer, count + 1)
Nothing -> (sum, count)
Probab
Chry Cheng schrieb:
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:
Laziness is a double-edged sword.
Perhaps the following page from Haskell Wiki would serve to enlighten
more: http://haskell.org/haskellwiki/Foldr_Foldl_Foldl%27? This
really made it clear to me how laziness can somet
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:
> Laziness is a double-edged sword.
Perhaps the following page from Haskell Wiki would serve to enlighten
more: http://haskell.org/haskellwiki/Foldr_Foldl_Foldl%27? This
really made it clear to me how laziness can sometimes be a bad thing.
_
On 2008 Oct 19, at 11:25, Friedrich wrote:
Ok to be more concrete is the laziness "hidden" here?
check_line line sum count =
let match = matchRegex regexp line
in case match of
Just strs -> (sum + read (head strs) :: Integer, count
+ 1)
Nothing -> (sum,
On 2008 Oct 19, at 11:24, Friedrich wrote:
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:
The relationship
between types and proofs is especially obvious in Haskell. And
proofs
aren't merely mathematical entities, they're expressions of what you
want to accomplish: if you can type y
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:
> On 2008 Oct 19, at 2:07, Friedrich wrote:
>> Howerver even if Strings are bad I can not see why they are hanging
>> around so long. I open a file a read it line by line and I close the
>> file so all read string are "garbage" and getting rid
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:
> On 2008 Oct 19, at 2:26, Friedrich wrote:
>> Paul Johnson <[EMAIL PROTECTED]> writes:
(By the way, putting in the top level type declarations helps a lot
>>> when you make a mistake.)
>> Well I have my problems with that. Probably it co
On 2008 Oct 19, at 11:18, Friedrich wrote:
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:
On 2008 Oct 19, at 2:07, Friedrich wrote:
Howerver even if Strings are bad I can not see why they are hanging
around so long. I open a file a read it line by line and I close the
file so all read s
"Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> writes:
> On 2008 Oct 19, at 2:07, Friedrich wrote:
>> Howerver even if Strings are bad I can not see why they are hanging
>> around so long. I open a file a read it line by line and I close the
>> file so all read string are "garbage" and getting rid
On 2008 Oct 19, at 2:26, Friedrich wrote:
Paul Johnson <[EMAIL PROTECTED]> writes:
(By the way, putting in the top level type declarations helps a lot
when you make a mistake.)
Well I have my problems with that. Probably it comes from using
Languages like Ruby and my special dislike of "typing
On 2008 Oct 19, at 2:07, Friedrich wrote:
Howerver even if Strings are bad I can not see why they are hanging
around so long. I open a file a read it line by line and I close the
file so all read string are "garbage" and getting rid of them should
not be that hard or should it?
If your code is
Paul Johnson <[EMAIL PROTECTED]> writes:
> Friedrich wrote:
>> I've written just a few programs in Haskell one in a comparison for a
>> task I had "nearly daily".
>>
> The first thing I notice is that this is clearly a direct translation
>> From something like Perl. Thats understandable, but I'd
Marshall Beddoe <[EMAIL PROTECTED]> writes:
> Also, read some chapters from here:
> http://book.realworldhaskell.org/read/
>
> Indispensable examples for writing higher performance log processing
> code.
I hope this book will soon be send out. I ordered my copy of course
;-)
Howerver even if Stri
Friedrich wrote:
I've written just a few programs in Haskell one in a comparison for a
task I had "nearly daily".
The first thing I notice is that this is clearly a direct translation
from something like Perl. Thats understandable, but I'd suggest
rewriting it with something like this (unte
H
mm..
The totals in "sum" and "count" are not computed until printed. This is too
lazy. You start with '0' and (+) things to it, but never examine or force the
value, so man many (+) thunks are built up in memory.
If you use bang patterns then the change can be made here, to !sum !count:
I've written just a few programs in Haskell one in a comparison for a
task I had "nearly daily".
The code analyzes Apache logs and picks some certain stuff from it and
after that calculates a bit around with it.
Here's the code
module Main where
import System
import System.IO
import System.Direct
24 matches
Mail list logo