size of an IO list

Sean Hinde <>
Mon Mar 7 12:53:42 CET 2005


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




More information about the erlang-questions mailing list