Tcl Source Code

View Ticket
Login
Ticket UUID: f8bc8efdf547eb8ddd92218ee1f8d91d0e0b4937
Title: Tutorial lesson 15 uses listName inconsistently with lappend/linsert/lreplace
Type: Bug Created on: 2016-08-23 22:32:46
Submitter: neirbowj Assigned to: nobody
Subsystem: 75. Tutorial Severity: Minor
Priority: 5 Medium Last modified: 2016-08-24 00:03:17
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: 8.5
Description:
The command signatures for lappend, linsert, and lreplace are presented in Lesson 15 of the tutorial ("Adding & Deleting members of a list") as follows.

lappend listName ?arg1 arg2 ... argn?
linsert listName index arg1 ?arg2 ... argn?
lreplace listName first last ?arg1 ... argn?

The latter should read like this instead.

linsert list index arg1 ?arg2 ... argn?
lreplace list first last ?arg1 ... argn?

According to the tutorial, the following interactive session should set `otherlist` to `{{one} {oneandahalf} {two} {three} {four}}`, return `two` from the corresponding `lindex` command, set `replacementlist` to {{one} {two} {tres} {cuatro}}`, and return `cuatro` from the corresponding `lindex` command.

    % set mylist [list one two three]
    one two three
    % lappend mylist four
    one two three four
    % lindex $mylist 3
    four
    % set otherlist [linsert mylist 1 oneandahalf]
    mylist oneandahalf
    % lindex $otherlist 2
    % set replacementlist [lreplace mylist 2 3 tres cuatro]
    mylist tres cuatro
    % lindex $replacementlist 3
    %
User Comments:
neirbowj added on 2016-08-24 00:03:17:
Edited title and description to cover `lreplace` too.