Proper or well formed Lists
Robert Virding
rv@REDACTED
Thu Dec 14 12:28:37 CET 2000
Francesco Cesarini <cesarini@REDACTED> writes:
>A well formed list follows the definition List = [Term|List] or []. Why
>where non proper (or well formed) lists (List = [Term|Term] ex:
>[hello|world]) allowed in the language in the first place?
>
>I am having a hard time seeing the need or intent with non well formed
>lists, other than a simplifying run-time evaluations and possibly the
>parsing. Wouldn't it have been better to have expressions not evaluating
>to a well formed list result in a run time error?
The reason is mainly hereditary, the high-level languages we were used
to when we started developing Erlang were Lisp and Prolog and both these
languages allow this. Also the early versions of Erlang were Prolog
interpreters. We did have some discussion about this but did really
feel it important enough to warrant a change.
Anyway think of the cool things you can do with it! Also think how
much more efficient cons is. :-)
Robert
More information about the erlang-questions
mailing list