Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-06-16
03:49 • Closed ticket [218326ffff]: Quick mapping of a small list to variables plus ... artifact: 27238b5683 user: dkf
2003-11-13
06:15 • Ticket [218326ffff]: 1 change artifact: 7ccd453d6f user: dgp
2001-09-18
01:22 • Ticket [218326ffff]: 4 changes artifact: 89675ec82d user: andreas_kupries
2001-04-16
22:50 • Ticket [218326ffff]: 1 change artifact: 724dbc46c4 user: dgp
22:49 • Open ticket [218326ffff]. artifact: a78ede0c8d user: dgp
2000-10-26
08:20 • Closed ticket [218326ffff]. artifact: ca89d7c438 user: welch
00:56 • New ticket [218326ffff]. artifact: 9021b40754 user: nobody

Quick mapping of a small list to variables

Closed / Accepted218326ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 22 years ago
Descriptionplain2000-10-26 00:56:15
OriginalBugID: 3869 RFE
Version: 8.0.3
SubmitDate: '1999-12-13'
LastModified: '1999-12-15'
Severity: LOW
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Linux-Red Hat
OSVersion: RedHat 5.2 i386
Machine: AMD K6-350 MHz
FixedDate: '2000-10-25'
ClosedDate: '1999-12-15'


Name:
Constantin Teodorescu

Extensions:
Tcl 8.0.3

DesiredBehavior:
It would be nice if we could assign the values from a small list to a list of variables:
set mylist [list Teo 35 Braila Romania]
lmap $mylist name age city country

"lmap" (list map) will be the new command. I know that there is a "lassign" command in TclX but I would like to find it also in pure Tcl. For the moment I'm  using:

foreach {name age city country} $mylist {}

but it's less elegant.



lassign can be made in pure Tcl, as noted on the newsgroup.
We are considering a new ::listx metacommand for 8.3/4. 
-- 12/15/1999 hobbs
welch Closed ticket [218326ffff]. [History diff]2000-10-26 08:20:06
dgp Open ticket [218326ffff]. [History diff]2001-04-16 22:49:51
dgp Ticket [218326ffff]: 1 change [History diff]2001-04-16 22:50:26
andreas_kupriesplain2001-09-18 01:22:37
Logged In: YES 
user_id=75003

Also see TIP 57 and 58 
(http://www.purl.org/tcl/tip/57.html, 
http://www.purl.org/tcl/tip/58.html)
dgp Ticket [218326ffff]: 1 change [History diff]2003-11-13 06:15:22
dkfplain2004-06-16 03:49:19
Logged In: YES 
user_id=79902

Tcl 8.5 includes an 'lassign' command with *exactly* the
syntax and semantics of the TclX version.
Log in (anonymous is fine) to add a comment.