Open kahlil29 opened 6 years ago
Okay I didn't know that this is what you were expecting. Thanks for explaining it in detail! I don't know the unix command-line options in so much depth, but your examples make it quite simple to understand! 😄
I'll go through what you've given and try to emulate the same behavior in my code.
Hello again!
I was thinking along the lines of writing emulating the full Unix utility rather than just a function that implements the behavior of the utility. For example on the command line, yes has the following behaviour (we use
head
to stop it from running infinitely):In Haskell this would probably look something like:
...and something similar for
sort
. These tasks are less about implementing the algorithm, and more about getting command line arguments, environment variables and using these to make a "complete" program. If you want to, you could useData.List.sort
to do the sorting for you.Your version of
sort
doesn't need to be an exact copy of thesort
utility, but maybe choose a few command line arguments which are easy enough to implement (Maybe a few like-r
,-n
,-t
and-o
, seeman sort
for details) You will most likely needSystem.Console.GetOpt
for this.For reference,
sort
has the following behaviour: