[erlang-questions] Irregular list

Mikael Pettersson mikpe@REDACTED
Thu Feb 12 16:38:03 CET 2009

Ladvánszky Károly writes:
 > Just getting acquainted with this wonderful system, I’ve run into the
 > following issue:
 > The shell seems to accept a structure like this: [a | b].
 > is_list([a | b]) returns true but length([a | b]) raises an exception.

is_list/1 only inspects the top-most node of the structure and tests
if it's a "list cell" or not. It's poorly named and corresponds to
testing for a "cons" in Lisp dialects.

 > Is it like an “open list” found in some programming languages?

Wouldn't know. Never heard of that one.

More information about the erlang-questions mailing list