size of an IO list
Thu Mar 3 09:14:10 CET 2005
lists:flatlength/1 works on a deep list of numbers, but not if the
list contains binaries, nor if the list or one of its sublists
is an improper list with a binary at the tail, as allowed for
luna@REDACTED (Daniel Luna) writes:
> On Wed, 2 Mar 2005, Joe Armstrong (AL/EAB) wrote:
> > How about a BIF to compute the size of an I/O list?
> > Why?
> > I have made a deep list that I want to output (guess what's it's HTML :-)
> > I need to make an HTTP header element "Content-Length: ..."
> > Which is the size of the flattened deep list , but I don't want to flatten it (horrors)
> > or traverse it (in Erlang) to find the length.
> > Suitable case for a BIF?
> There is lists:flatlength/1 that does this, unfortunately it's not a BIF.
> Daniel Luna | Top reasons that I have a beard:
> luna@REDACTED | a) Laziness.
> http://www.update.uu.se/~luna/ | b) I can.
> Don't look at my homepage (it stinks).| c) I can get away with it.
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions