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

From Rosetta Code
Content added Content deleted
(Unreasonably vague task description)
 
m (added some comments.)
Line 23: Line 23:


Every single one of these questions will change the way the program must be written. --[[User:Thundergnat|Thundergnat]] ([[User talk:Thundergnat|talk]]) 14:34, 3 August 2021 (UTC)
Every single one of these questions will change the way the program must be written. --[[User:Thundergnat|Thundergnat]] ([[User talk:Thundergnat|talk]]) 14:34, 3 August 2021 (UTC)


: I'll attempt to clarify at least one of your points.   It appears, from the   '''Ring'''   computer programming langage example,   that what is meant is to show the lines (records?) in reverse order,   and not change the order of the characters within each line (record).   I will also add a very small "file" so that we can compare output(s) without having to show the input lines(records).     -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 15:16, 3 August 2021 (UTC)

Revision as of 15:16, 3 August 2021

Incredibly vague task

Once again, the master of vagarity has struck. Some details need to be hammered out for this to be a task.

  • What is a line?
    • Is it a record that ends with a 0xD character?
    • a 0xA character?
    • a 0xA 0xD digraph?
    • Is there a particular encoding that can be assumed? (ASCII?, EBCDIC?, ISO-Latin-1?, UTF8?)
    • How about binary files?
  • What is to be reversed?
    • Each record in the file?
    • The order of records in a file?
    • Both?
    • What about binary files?
  • What restrictions are there on holding the file in memory?
    • Can it be read in all at once?
    • Does it need to be processed a record at a time?
    • Does it need to be read in starting from the end of the file, proceeding to the beginning?
      • If so, should it be processed in non-record sized blocks?
      • Or a byte / character at a time? (Which circles back around to encoding.)

Every single one of these questions will change the way the program must be written. --Thundergnat (talk) 14:34, 3 August 2021 (UTC)


I'll attempt to clarify at least one of your points.   It appears, from the   Ring   computer programming langage example,   that what is meant is to show the lines (records?) in reverse order,   and not change the order of the characters within each line (record).   I will also add a very small "file" so that we can compare output(s) without having to show the input lines(records).     -- Gerard Schildberger (talk) 15:16, 3 August 2021 (UTC)