[erlang-questions] definition of iolist
Fri Aug 31 17:17:53 CEST 2007
David Terrell wrote:
> On Fri, Aug 31, 2007 at 02:27:54PM +0200, Bjorn Gustavsson wrote:
>> Anthony Shipman <als@REDACTED> writes:
>>> The documentation often says this:
>>> iolist = [char() | binary() | iolist()]
>>> a binary is allowed as the tail of the list
>>> This says to me that an iolist is a list whose members can be characters,
>>> binaries or iolists. In which case it is automatic that a binary can be the
>>> tail of the list. So what is the point of the comment?
>> A character is not allowed in the tail.
> I think I'm misunderstanding you... wouldn't this forbid a
> normal erlang string from being considered a valid iolist?
> 1> list_to_binary(["abcdefg", $h]).
The final tail of "abcdefg" (and any other proper list) is nil.
A list that has a binary as its tail is an improper list.
David Hopwood <david.hopwood@REDACTED>
More information about the erlang-questions