[Swift-user] app with same input and output file
Mihael Hategan
hategan at mcs.anl.gov
Wed Nov 12 14:46:03 CST 2014
On Wed, 2014-11-12 at 16:49 +0000, Ketan Maheshwari wrote:
> I have an app use-case which receives an input file and does some sedawk
> manipulations in it which is the output file.
>
> Essentially, both input and output are the same files, only the contents
> are changed.
>
> Any ideas on how to express this with Swift?
You can't. At least not in the form outlined above. If a variable, x,
could have two values, then the value of some arbitrary function, f(x),
would depend on when the invocation occurs, which would result in
nondeterminism.
One possibility to achieve something similar would be to give your
variable a sequence number to encode the different versions that it
could have. You could do this with an array.
Mihael
More information about the Swift-user
mailing list