Reverse the order of lines in a text file while preserving the contents of each line: Difference between revisions

Content added Content deleted
(Add Factor)
m (→‎{{header|Factor}}: Make more robust by handling possible trailing newline)
Line 24: Line 24:
<lang factor>USING: io io.encodings.utf8 io.files sequences ;
<lang factor>USING: io io.encodings.utf8 io.files sequences ;


"rodgers.txt" utf8 file-lines <reversed> [ print ] each</lang>
"rodgers.txt" utf8 file-lines harvest <reversed> [ print ] each</lang>
{{out}}
{{out}}
<pre>
<pre>
--- Will Rodgers
--- Will Rodgers

until you can find a rock."
until you can find a rock."
saying 'Nice Doggy'
saying 'Nice Doggy'