Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to preserve order of associative array?



>   The attributes of a parameter determine the _type_ of its value, often
>   referred to as the parameter type or variable type, and also control
>   other processing that may be applied to the value when it is referenced.
>   The value type may be a _scalar_ (a string, an integer, or a floating
>   point number), an array (indexed numerically), or an _associative_
>   array (an unordered set of name-value pairs, indexed by name, also
>   referred to as a _hash_).

Thank you very much. That explains it. I've overseen that in the documentation.


> You can simulate an ordered set of name-value pairs like this (need zsh
> version 5.1 for assigning to an array during typeset):
>
>     typeset -a ord_array=(one 1 two 2 three 3 four 4)
>     print ${ord_array[ord_array[(i)three]+1]}

Perfect! I'll try that. Thanks.



Messages sorted by: Reverse Date, Date, Thread, Author