turing machine in an LC
Jeremy Bowers
jerf at jerf.org
Tue Feb 8 08:57:23 EST 2005
On Tue, 08 Feb 2005 10:50:24 -0800, Michael Spencer wrote:
> I see no difference between LCs and GEs in this respect:
>
> >>> import itertools as it
> >>>
> >>> def fact_ge(n):
> ... f = [1]
> ... f.extend(i*j for i,j in it.izip(xrange(1,1+n), f))
> ... return f
> ...
> >>> def fact_lc(n):
> ... f = [1]
> ... [f.append(i*j) for i,j in it.izip(xrange(1,1+n), f)]
> ... return f
The comments in my other post still hold true w.r.t. these not being just
LCs or genexps, but you have a point here. Allowing an external list will
give you the storage you need even for a LC.
OK then, I still don't quite see how you can build a Turing Machine in one
LC, but an LC and one preceding list assignment should be possible,
although the resulting list from the LC is garbage; the preceding list
will have the actual state data.
More information about the Python-list
mailing list