Re: [Haskell-cafe] more functions to evaluate

2007-10-13 Thread Rodrigo Queiro
Dan: Sorry, I forgot to Reply to All. On 12/10/2007, Dan Weston [EMAIL PROTECTED] wrote: ... We don't want to make an intermediate list of zeroes and append, since that could be wasteful. Just keep adding a zero to the head of our list until it gets big enough. Our list is not copied (i.e. it

Re: [Haskell-cafe] more functions to evaluate

2007-10-13 Thread Derek Elkins
On Fri, 2007-10-12 at 16:20 -0700, Dan Weston wrote: I like that name, and will henceforth use it myself until someone sees fit to add it to the Prelude! Maxime Henrion wrote: Isaac Dupree wrote: Dan Weston wrote: applyNtimes :: (a - a) - Int - a - a This sounds like it should be

[Haskell-cafe] more functions to evaluate

2007-10-12 Thread PR Stanley
Hi folks Any comments and/or criticisms no matter how trivial on the following please: wordSize :: [Int] - Int wordSize xs = head (dropWhile ((length xs)) $ iterate (*2) 8) intToBinWord :: Int - [Int] intToBinWord n = reverse (take elements (xs ++ repeat 0))

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Thomas Hartman
@haskell.org cc Subject [Haskell-cafe] more functions to evaluate Hi folks Any comments and/or criticisms no matter how trivial on the following please: wordSize :: [Int] - Int wordSize xs = head (dropWhile ((length xs)) $ iterate (*2) 8

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Dan Weston
Here is my suggestion: separation of concerns. Your functions are doing multiple things at once (and there are inefficiencies in your code that are not easy to see because it does do several things at once). You want the smallest word that an int will fit in. Sounds like you'll need a

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Isaac Dupree
Dan Weston wrote: applyNtimes :: (a - a) - Int - a - a This sounds like it should be in the library somewhere agree, I've used it a few times (mostly for testing things) - modulo argument order and Int vs. Integer vs. (Num a = a) Isaac ___

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Maxime Henrion
Isaac Dupree wrote: Dan Weston wrote: applyNtimes :: (a - a) - Int - a - a This sounds like it should be in the library somewhere agree, I've used it a few times (mostly for testing things) - modulo argument order and Int vs. Integer vs. (Num a = a) What do you think about calling it

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Dan Weston
I like that name, and will henceforth use it myself until someone sees fit to add it to the Prelude! Maxime Henrion wrote: Isaac Dupree wrote: Dan Weston wrote: applyNtimes :: (a - a) - Int - a - a This sounds like it should be in the library somewhere agree, I've used it a few times

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Maxime Henrion
Dan Weston wrote: I like that name, and will henceforth use it myself until someone sees fit to add it to the Prelude! Oh, and I guess we'd also need: genericIterateN :: (a - a) - Integer - a - a Which also got me thinking, wouldn't it make more sense to have the count as the first

Re: [Haskell-cafe] more functions to evaluate

2007-10-12 Thread Maxime Henrion
Maxime Henrion wrote: Dan Weston wrote: I like that name, and will henceforth use it myself until someone sees fit to add it to the Prelude! Oh, and I guess we'd also need: genericIterateN :: (a - a) - Integer - a - a Which also got me thinking, wouldn't it make more sense to have