[erlang-questions] Testing for improper list

黃耀賢 (Yau-Hsien Huang) g9414002.pccu.edu.tw@REDACTED
Mon Jul 16 04:37:35 CEST 2018


As off topic, the is_improper_list/1 may be rewritten to ...

is_improper_list([_|Value]) -> is_improper_list(Value);

On Mon, Jul 16, 2018 at 8:17 AM, Guilherme Andrade <g@REDACTED> wrote:

> Hello Karlo,
>
> On 16 July 2018 at 01:07, Karlo Kuna <kuna.prime@REDACTED> wrote:
>
>> Is there any built in method of checking if list is improper?
>>
>
> Something like this should do:
>
> > is_improper_list(Value) when length(Value) >= 0
> ->
>
>
> >     false;
>
>
>
> > is_improper_list(Value) ->
>
>
>
> >     is_list(Value).
>
> `length/1' will fail upon Value being an improper list.
>
> --
> Guilherme
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>


-- 

Best Regards.

--- Y-H. H.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180716/a70e8b20/attachment.htm>


More information about the erlang-questions mailing list