Add <flipped> word
parent
879e43a52b
commit
7aa542d7c3
|
@ -4,7 +4,9 @@ IN: columns
|
|||
ARTICLE: "columns" "Column sequences"
|
||||
"A " { $emphasis "column" } " presents a column of a matrix represented as a sequence of rows:"
|
||||
{ $subsection column }
|
||||
{ $subsection <column> } ;
|
||||
{ $subsection <column> }
|
||||
"A utility word:"
|
||||
{ $subsection flipped } ;
|
||||
|
||||
HELP: column
|
||||
{ $class-description "A virtual sequence which presents a fixed column of a matrix represented as a sequence of rows. New instances can be created by calling " { $link <column> } "." } ;
|
||||
|
@ -23,4 +25,9 @@ HELP: <column> ( seq n -- column )
|
|||
"In the same sense that " { $link <reversed> } " is a virtual variant of " { $link reverse } ", " { $link <column> } " is a virtual variant of " { $snippet "swap [ nth ] curry map" } "."
|
||||
} ;
|
||||
|
||||
HELP: <flipped>
|
||||
{ $values { "seq" sequence } { "seq'" sequence } }
|
||||
{ $description "Outputs a new virtual sequence which presents the transpose of " { $snippet "seq" } "." }
|
||||
{ $notes "This is the virtual sequence equivalent of " { $link flip } "." } ;
|
||||
|
||||
ABOUT: "columns"
|
||||
|
|
|
@ -13,3 +13,6 @@ M: column virtual@ dup col>> -rot seq>> nth bounds-check ;
|
|||
M: column length seq>> length ;
|
||||
|
||||
INSTANCE: column virtual-sequence
|
||||
|
||||
: <flipped> ( seq -- seq' )
|
||||
dup first length [ <column> ] with map ;
|
||||
|
|
Loading…
Reference in New Issue