sizeFM type
Carsten Schultz
carsten at codimi.de
Tue Apr 27 13:35:34 EDT 2004
On Mon, Apr 26, 2004 at 06:42:20AM -0400, David Roundy wrote:
> On Sun, Apr 25, 2004 at 11:38:19PM +0200, Tomasz Zielonka wrote:
> > On Sun, Apr 25, 2004 at 04:12:25PM -0400, David Roundy wrote:
> > >
> > > On the other hand, since they are still 32 bit computers, any given
> > > application can still only access 4G of memory. This issue will only be a
> > > problem on 64 bit platforms which have a 32 bit Int.
> >
> > Here is a funny program that gives wrong result because of length
> > returning Int on a 32-bit computer.
> >
> > import Data.List
> > main = print (length (genericTake 5000000000 (repeat ())))
> >
> > Running it shows
> >
> > $ ./A
> > 705032704
> >
> > But this is a strange piece of code and I agree that it will hardly be a
> > problem on a 32 bit platform.
>
> In fact, the only way this will be a problem is if your list is lazy and
> consumed by the length function, but it's hard to see how that could happen
> except in strange example code. That is, it's hard to imagine when you'd
> need to know the length of a data structure you don't need...
Think `wc -l'.
Greetings,
Carsten
--
Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin
http://carsten.codimi.de/
PGP/GPG key on the pgp.net key servers,
fingerprint on my home page.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/glasgow-haskell-users/attachments/20040427/71f894cf/attachment.bin
More information about the Glasgow-haskell-users
mailing list