| <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>lassign_array</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Apache Rivet"><link rel="up" href="commands.html" title="Rivet Tcl Commands and Variables"><link rel="prev" href="inspect.html" title="inspect"><link rel="next" href="lempty.html" title="lempty"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">lassign_array</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="inspect.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center">Rivet Tcl Commands and Variables</th><td width="20%" align="right"> <a accesskey="n" href="lempty.html"><img src="images/next.png" alt="Next"></a></td></tr></table></div><div class="refentry"><div class="refentry.separator"><hr></div><a name="lassign_array"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>lassign_array — Assign a list of values to array variables</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::lassign_array</span> ?<span style="font-family:monospace; font-weight: bold;">value_list</span>? ?<span style="font-family:monospace; font-weight: bold;">array_name</span>? ?<span style="font-family:monospace; font-weight: bold;">array_variables</span>?</div></div></div><div class="refsect1"><a name="idm1145"></a><h2>Description</h2><p style="width:90%"> |
| <span style="font-family:monospace"><span class="command"><strong>lassign_array</strong></span></span> is an utility command inspired by the same Tclx command and |
| with a close resemblance with Tcl's <span style="font-family:monospace"><span class="command"><strong>lassign</strong></span></span> for assigning list elements to variables. |
| <span style="font-family:monospace"><span class="command"><strong>lassign_array</strong></span></span> first argument is a list of values to be assigned to an array that must be |
| given as second argument. The remaining arguments are the array's variable names which will store |
| as values the elements of the list. Variables names don't matching values in the list are given an empty string. |
| Unassigned list elements are returned as a list. |
| </p><pre class="programlisting">::rivet::lassign_array {1 2 3 4} assigned_array a b c d |
| parray assigned_array |
| <span class="strong"><strong>assigned_array</strong></span> |
| assigned_array(a) = 1 |
| assigned_array(b) = 2 |
| assigned_array(c) = 3 |
| assigned_array(d) = 4 |
| |
| set rem [::rivet::lassign_array {1 2 3 4 5 6 7} assigned_array a b c d] |
| puts $rem |
| 5 6 7</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="inspect.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="commands.html"><img src="images/up.png" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="lempty.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">inspect </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> lempty</td></tr></table></div></body></html> |