TIP #289 Version 1.1: Revision of [lrepeat] Argument Order

This is not necessarily the current version of this TIP.


TIP:289
Title:Revision of [lrepeat] Argument Order
Version:$Revision: 1.1 $
Author:Peter Spjuth <peter dot spjuth at space dot se>
State:Draft
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Thursday, 26 October 2006
Keywords:Tcl

Abstract

This TIP proposes to alter the argument order of lrepeat to be similar to string repeat.

Rationale

In TIP #136, lrepeat is defined as:

lrepeat number element1 ?element2? ?element3? ...

whereas the old string repeat command is:

string repeat string number

This difference between similar commands is bound to cause confusion. Consistency is good.

Specification

Change lrepeat's argument order to:

lrepeat element1 ?element2? ?element3? ... number

Examples:

 lrepeat 0 100                - returns list of 100 zeros
 lrepeat [lrepeat 0 100] 100  - returns 100x100 matrix (list of lists) of zeros
 lrepeat a b c 3              - returns nine-element list {a b c a b c a b c}
 lrepeat a b c 1              - identical to [list a b c]

Copyright

This document has been placed in the public domain.


Powered by TclThis is not necessarily the current version of this TIP.

TIP AutoGenerator - written by Donal K. Fellows