[Swift-user] still stuck on fold9.swift
Ben Clifford
benc at hawaga.org.uk
Tue Jun 16 17:26:25 CDT 2009
On Tue, 16 Jun 2009, Hodgess, Erin wrote:
> Ok. We're back to fold9.swift again, but it's saying that there are
> multiple writers.
> These are in /home/erin/swift1.
>
> Is it because of the recursive nature of the a[v+1] setup, maybe?
This is a static compile time analysis problem - Swift looks at the source
code and sees that you are assigning to the a[] array in one place (the
a[0] statement, outside of iterate) and again in another place (the a[v+1]
place inside of iterate).
Its bothered me in the past that this hasn't worked, but I hadn't realised
that it did at one stage actually work (which it must have done to be
written in the tutorial).
Its probably useful to file a bug about this, then - its a comment I have
from doing things with the 3rd provenance challenge over the past couple
of months too. I think in the long term its a use that should be accepted,
but the syntax of Swift makes this kind of analysis incredibly awkward to
get right.
You can maybe around this by something like this (untested):
replace
a[v+1] = countstep(a[v]);
with
if(v==0) { a[v+1] = countstep(startfile); }
else { a[v+1] = countstep(a[v]); }
and replace the a[0] assignment line with:
countfile startfile = echo("793578934574893");
--
More information about the Swift-user
mailing list