Talk:Execute a Markov algorithm: Difference between revisions

Line 169:
:::: Plus the fact that the ruleset definition includes a comment syntax (which I didn't write, just tidied up) is highly indicative that it was originally intended to be file-hosted. (I'm not sorry to lose the requirement for input and output data though.) –[[User:Dkf|Donal Fellows]] 09:37, 20 December 2009 (UTC)
:::::Hi Donal, on some operating systems, like flavours of Unix, stipluating the data source to be a file makes it very flexible, as most things are made to look like a file by the OS: ftp, HTTP, pipes, ... if your program aaccepts files, then all is well. This may not be the case in other operating systems. I think it is OK to treat the source of the data as a separate concern that is not part of the task. --[[User:Paddy3118|Paddy3118]] 23:12, 20 December 2009 (UTC)
:::::: I think I'm going to hold out for at least the ruleset coming from another file. The general concept carries over pretty well into all other operating environments that I'm aware of, and even when the environment doesn't support files ''per se'', there's something that can be used instead; requiring that all information be embedded into the source code of the program isn't exactly practical on any of them. (The separation is also very convenient when writing rulesets; it prevents silly accidents in editing and keeps the language's string syntax out of the way.) –[[User:Dkf|Donal Fellows]] 07:23, 21 December 2009 (UTC)
:::The old Unix way would be to have a couple of flags -f rule_file, and optionally -o output_file. The input file would be any additional files specified on the command line or, if none were specified, from stdin. The output would be to stdout unles the -o option was specified.
:::examples:
::::<code>process1 | markov -f myRules | process2</code>
::::<code>markov -f myRules -o myOut.txt myInput.txt myInput2.txt myInput3.txt</code>
::::<code>markov -f myRules < myInput.txt > myOutput.txt</code>
:::--[[User:Rldrenth|Rldrenth]] 00:25, 21 December 2009 (UTC)
:::: The traditional Unix way would have omitted the <code>-o</code> option, and quite possibly the support for data input files. After all, there's redirection available and you could use <code>cat</code> to build the input. However, the rules file would still not be optional (unless the command also supports a <code>-e ''ruleset''</code> option) and the use of <code>-f</code> before it would be optional (and only useful when you feel the need to begin the filename with a hyphen). '''But''' this level of complexity is really best of not being put in this task; it's total distraction!
:::: And in any case, I used <code>/proc/self/fd/'''['''01''']'''</code> when testing. There's ''always'' a way… –[[User:Dkf|Donal Fellows]] 07:23, 21 December 2009 (UTC)
Anonymous user