size of an IO list

Hakan Mattsson hakan@REDACTED
Wed Mar 2 17:38:28 CET 2005


On Wed, 2 Mar 2005, Joe Armstrong (AL/EAB) wrote:

JA>  How about a BIF to compute the size of an I/O list?
JA> 
JA>  Why?
JA> 
JA>  I have made a deep list that I want to output (guess what's it's HTML :-)
JA> 
JA>  I need to make an HTTP header element  "Content-Length: ..."
JA> 
JA>  Which is the size of the flattened deep list , but I don't want to flatten it (horrors)
JA>  or traverse it (in Erlang) to find the length.
JA> 
JA>  Suitable case for a BIF?

What about Bin = list_to_binary(List), size(Bin)?

/Håkan


More information about the erlang-questions mailing list