[EMAIL PROTECTED] wrote:
However, arguably the biggest imperatives for Haskell 98 was to remove
features that would confuse undergraduates.
[...]
People want to write map instead of fmap. We could have come up
with an alternative name for the list-version of map and not showed
map to newbies.
On 10/15/07, apfelmus [EMAIL PROTECTED] wrote:
Of course, the solution is to first drop n elements and then take
tails instead of dropping n elements every time.
map (drop n) . tails = tails . drop n
O(m*n) O(m)
Nice identity. I'll remember this one.
With
2007/10/15, Felipe Lessa [EMAIL PROTECTED]:
On 10/15/07, apfelmus [EMAIL PROTECTED] wrote:
Of course, the solution is to first drop n elements and then take
tails instead of dropping n elements every time.
map (drop n) . tails = tails . drop n
O(m*n)
Felipe Lessa wrote:
apfelmus wrote:
Of course, the solution is to first drop n elements and then take
tails instead of dropping n elements every time.
map (drop n) . tails = tails . drop n
O(m*n) O(m)
Nice identity. I'll remember this one.
Oops, please don't
On Oct 15, 2007, at 7:59 , Felipe Lessa wrote:
On 10/15/07, apfelmus [EMAIL PROTECTED] wrote:
lasts :: Int - [a] - [a]
lasts n xs = head $ [x | (x,[]) - zip (tails xs) (tails $ drop
n xs)]
(...)
main n = print . sum . map read . lasts n . lines = getContents
But that's a a
Vimal wrote:
I have been trying my best to read about Haskell from the various
tutorials available on the internet and blogs.
[...]
So, I requested my institute to buy Dr. Graham Hutton's book. I would
be getting hold of that quite soon, and am willing to start from the
beginning.
IMHO, the
Brian Hurt wrote:
I mean, contemplate this trivial exercise for a moment: write a program
that reads from stdin a series of numbers (one number per line), and
writes out the sum of the last n numbers. This is a trivial problem,
and I have no doubt that someone who knows Haskell better than I
apfelmus wrote:
I mean, contemplate this trivial exercise for a moment: write a program
that reads from stdin a series of numbers (one number per line), and
writes out the sum of the last n numbers. This is a trivial problem,
and I have no doubt that someone who knows Haskell better than
On 10/14/07, Prabhakar Ragde [EMAIL PROTECTED] wrote:
main n = print . sum . map read . take n . reverse . lines = getContents
Could someone describe succinctly how to compute the space complexity of
this program, if there are m lines of input and m n? Many thanks. --PR
'reverse' needs to
More neatly, we can fully separate IO from computation:
h n = interact $ show . sum . map read . take n . reverse . lines
Better yet go a small step further and make *composable* combinations of IO
pure computation, as in TV (http://haskell.org/haskellwiki/TV).
Cheers, - Conal
On
Hi
main n = print . sum . map read . take n . reverse . lines = getContents
Could someone describe succinctly how to compute the space complexity of
this program, if there are m lines of input and m n? Many thanks. --PR
The space complexity is the size of the file - i.e. of size m. reverse
[EMAIL PROTECTED] wrote in article [EMAIL PROTECTED] in
gmane.comp.lang.haskell.cafe:
That's not my experience. I didn't really understand Kalman filters
until I read the Wikipedia page. It's better than most of the tutorials
out there.
While we're off topic, here's a nice introduction to
12 matches
Mail list logo