TIP #289: REVISION OF [LREPEAT] ARGUMENT ORDER ================================================ Version: $Revision: 1.5 $ Author: Peter Spjuth State: Rejected Type: Project Tcl-Version: 8.5 Vote: Done Created: Thursday, 26 October 2006 URL: https://tip.tcl-lang.org289.html Post-History: ------------------------------------------------------------------------- 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] DISCUSSION: ============= DGP: The main feature that appears to get lost in this change is the ability to redirect aliases or subcommands of ensembles to *lrepeat* calls with the number of repetitions already filled in. PS: On the other hand, you get the ability to redirect aliases or subcommands of ensembles to *lrepeat* calls with the elements already filled in. DGP: I skimmed the old TIP 136 messages in the TCLCORE archives. One thing to note is that the existing *lrepeat* syntax in 8.5a5 was chosen in part to be consistent with the existing *struct::list repeat* syntax in the struct::list package. DGP: I think it's fair to say that given a complete "do-over" more of us would opt to change *string repeat* to agree with *lrepeat* and *struct::list repeat* than the other way around. COPYRIGHT =========== This document has been placed in the public domain. ------------------------------------------------------------------------- TIP AutoGenerator - written by Donal K. Fellows