blob: 8ae3af756c68c52848a5ebaffb682da4f08ef998 [file] [log] [blame]
Zesstrad59c3892019-11-28 20:53:39 +01001SYNOPSIS
2 mixed * transpose_array(mixed *arr)
MG Mud User88f12472016-06-24 23:31:02 +02003
Zesstra715ec202025-07-09 22:18:31 +02004DESCRIPTION
5 transpose_array(({ ({1,2,3}), ({a,b,c}) }))
6 == ({ ({1,a}), ({2,b}), ({3,c}) })
MG Mud User88f12472016-06-24 23:31:02 +02007
Zesstra715ec202025-07-09 22:18:31 +02008 transpose_array() applied to an alist results in an array of
9 ({ key, data }) pairs, useful if you want to use sort_array()
10 or filter() on the alist.
MG Mud User88f12472016-06-24 23:31:02 +020011
Zesstra715ec202025-07-09 22:18:31 +020012EXAMPLES
13 sort_array(transpose_array(({ m_indices(map), m_values(map) })),
14 lambda(({ 'a, 'b }),
15 ({ #'<, ({ #'[, 'a, 0 }),
16 ({ #'[, 'b, 0}) }) )
MG Mud User88f12472016-06-24 23:31:02 +020017
Zesstra715ec202025-07-09 22:18:31 +020018 The given mapping 'map' is returned as an array of
19 ({ key, data }) pairs, sorted by the keys.
MG Mud User88f12472016-06-24 23:31:02 +020020
Zesstra715ec202025-07-09 22:18:31 +020021SEE ALSO
Zesstrad59c3892019-11-28 20:53:39 +010022 alists(LPC), sort_array(E)