Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6145145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:45:16+00:00 2026-05-23T18:45:16+00:00

I want to create a list and each element of it is an array,

  • 0

I want to create a list and each element of it is an array, similarly to an array of structs in C language.
Can it be done in TCL and how if it can? thanks very much!

I did some try but it failed…

tcl>set si(eid) -1
tcl>set si(core) 0
tcl>set si(time) 0
tcl>lappend si_list "$si"
Error: can't read "si": variable is array
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:45:17+00:00Added an answer on May 23, 2026 at 6:45 pm

    You can’t create a list of arrays, but you can create a list of dicts which is functionally the same thing (a mapping from keys to values):

    set mylist [list [dict create a 1 b 2] [dict create a 4 b 5]]
    puts [dict get [lindex $mylist 1] a]
    

    To do it as arrays you need to use [array get] and [array set] to change the array into a string:

    set si(eid) -1
    set si(core) 0
    set si(time) 0
    lappend si_list [array get si]
    

    And to get it back out

    array set newsi [lindex $si_list]
    puts $newsi(eid)
    

    dicts let you work on the {name value} lists directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Java, how can I create an array where each element is a list
I want to create a list of methods to execute. Each method has the
I want to create a series of lists, all of varying lengths. Each list
I want to create a ArrayAdapter for one spinner. So each element contain one
I want to create a list of columns in SQL Server 2005 that have
I want to create a list of integers from 1 to n . I
I want to create a List of KeyValuePair s in a managed C++ project.
I want to create a list of lambda objects from a list of constants
I want to create a list of category terms (contained within a block), with
I want to create a list of GridBagPanel.Constraints . I read it in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.