[erlang-questions] lists documentation error

Jay Nelson jay@REDACTED
Fri Jun 13 15:54:07 CEST 2008


That seems like a good addition to the text of the documentation.
The way it is written now implies that any combination of start + length
is OK.

On Jun 12, 2008, at 11:37 PM, Doug Edmunds wrote:

>
> 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
>




More information about the erlang-questions mailing list