zsh-users
 help / color / mirror / code / Atom feed
* How to preserve order of associative array?
@ 2015-11-07 16:11 Dominik Ritter
  2015-11-07 17:08 ` Mikael Magnusson
  2015-11-07 17:51 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Dominik Ritter @ 2015-11-07 16:11 UTC (permalink / raw)
  To: zsh-users

Hi everyone!

I struggle to the order of an associative array right. If I take the
example from zsh-lovers man page:

    $ typeset -A ass_array; ass_array=(one 1 two 2 three 3 four 4)
    $ print ${(k)ass_array} # prints keys
    one four two three
    $ print ${(v)ass_array} # prints values
    1 4 2 3

I would expect that to be the keys sorted as they appear in the array
(one, two, three, four).

I tried to sort them in array index order, but without luck:
print ${(ak)ass_array}

The other sort-modifiers won't help me, as I need a hierarchy in my
array keys (neither lexically, nor numerical).

Thanks for any help. Regards,
Dominik


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-11  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-07 16:11 How to preserve order of associative array? Dominik Ritter
2015-11-07 17:08 ` Mikael Magnusson
2015-11-07 17:51 ` Bart Schaefer
2015-11-10 20:52   ` Dominik Ritter
2015-11-11  0:59     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).