The transpose
operation has the following representation in
virtual code.
transpose
]] = ((nil,nil),((nil,nil),(nil,nil)))
This function takes a list of equal length lists as an argument, and returns a list of lists as a result. In the resulting list, the first item is the list of all first items of lists in the argument. The next item is the list of all second items, and so on.
In the specification of the semantics, the silly
mnemonic
flat
is defined by flat = reduce(cat,nil)
in the standard
silly
prelude, which means that it flattens a list of lists into
one long list.
transpose
]] x = nil
if [[flat
]] x = nil
transpose
]] x =
(
[[map left
]] x,
[[transpose
]] [[map right
]] x)
flat
]] x is a non-nil
tree