Transpose: Difference between revisions

From The K Language Wiki
Content added Content deleted
mNo edit summary
No edit summary
Line 10: Line 10:
`b`d
`b`d
`c`d)
`c`d)

== Atoms and lists ==

Transposing a list in oK or ngn/k [[enlist]]s it. Transposing an atom enlists twice:

+,0
,,0
+0
,,0

K4 and Kona return the argument as-is.

K9 throws a rank error.

Revision as of 16:48, 6 July 2021

Transpose
{{{1}}}

Transpose (a.k.a. flip) swaps the leading two axes of a 2+ dimensional rectangular array. Dialects differ in their treatment of atoms, lists, and ragged arrays.

 +("ab";"cd";"ef")
("ace"
 "bdf")

 +(`a`b`c;`d)
(`a`d
 `b`d
 `c`d)

Atoms and lists

Transposing a list in oK or ngn/k enlists it. Transposing an atom enlists twice:

 +,0
,,0
 +0
,,0

K4 and Kona return the argument as-is.

K9 throws a rank error.