[erlang-questions] lists documentation error

Doug Edmunds dougedmunds@REDACTED
Fri Jun 13 08:37:51 CEST 2008


The Type information for lists:sublist/3
places this restriction on Start:

Start = 1..(length(List1)+1)

As long as Start does not exceed length(List1)+1,
Start + Length can be >  than the length of the list.

For example:
    lists:sublist([1,2,3,4], 4, 2000).
is ok.

-dae

On Thu, Jun 12, 2008 at 9:57 PM, Jay Nelson <jay@REDACTED> wrote:

> The documentation for lists:sublist/3 gives an example to show that
> there is no error for start+length > the length of the list:
>
>  > lists:sublist([1,2,3,4], 5, 2).
> []
>
> However, in R12B-2 I try the following:
>
>  > lists:sublist([1,2,3,4], 6, 2).
> ** exception error: no function clause matching lists:nthtail(1,[])
>      in function  lists:sublist/3
>
> jay
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080612/c16c5fa3/attachment.htm>


More information about the erlang-questions mailing list