size of an IO list

Bjorn Gustavsson <>
Mon Mar 7 13:43:15 CET 2005


Sorry, I meant that iolist_size/1 should be implemented like

iolist_size(IOList) ->
         size(list_to_binary([IOList])).

/Bjorn

Sean Hinde <> writes:

> On 7 Mar 2005, at 10:20, Bjorn Gustavsson wrote:
> 
> > As usual, the hardest part is usually coming up with a good name.
> > After some discussion, Kenneth and I come up with the following
> > suggestion for TWO new BIFs.
> >
> >         iolist_size(IOList)
> >         iolist_to_binary(IOList)
> >
> > where iolist_to_binary/1 will work like this
> >
> > iolist_to_binary(IOList) ->
> >         size(list_to_binary([IOList])).
> >
> > but be much faster (and obviously not build the temporary binary).
> >
> > The reason for the new iolist_to_binary/1 BIF is that is not clear
> > that iolist_size/1 is any way releated to list_to_binary/1.
> 
> I'm not quite sure I get this. iolist_to_binary([1,<<2,3,4>>]) would
> just return 4? Not a binary?
> 
> Otherwise great. I usually type io_list with an underscore, but too
> many underscores are also problematic io_list_to_binary.. Don't mind.
> 
> Sean
> 

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list