Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b6ce2e63088fc44d03aac64e563eac8929b3ac42
Ticket: 3163961fffffffffffffffffffffffffffffffff
TIP 405: mapeach implementation with bytecoding
User & Date: twylite on 2012-08-03 23:55:19
Changes

  1. icomment:
    Latest implementation committed to branch 'tip-405-impl-td'.  This includes 'mapeach' and 'dict map' with full test suites, a bug fix made since the last patchfile, and man pages.
    
    Also included is an experimental accumulating foreach tentatively named 'foreacha'.  [foreacha] treats the first list variable as an accumulator.  The accumulator consumes a list element on the first iteration only, and is returned by [foreacha].
    
    Examples of [foreacha]:
    
    fold with initial var: foreacha a 0 b {1 2 3 4} { incr a $b }
    fold without initial var: foreacha {a b} {1 2 3 4} { incr a $b }
    filter: foreacha a {} b {1 2 3 4} { if { ($b % 2)==0 } { lappend a $b } }
    map: foreacha a {} b {1 2 3 4} { lappend a [expr { $b * 5 }] }
    prefix: foreacha a {} b {1 2 3 4} { if { $b > 2 } break; lappend a $b }
    
    
    
  2. login: "twylite"
  3. mimetype: "text/plain"
  4. username: "twylite"