Conway's Life
Abraham Egnor
aegnor@antioch-college.edu
Wed, 5 Mar 2003 21:52:44 -0500 (EST)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---559023410-851401618-1046919164=:9250
Content-Type: TEXT/PLAIN; charset=US-ASCII
I'm implementing Conway's Life in Haskell; my basic implementation is
attached. Does anyone have suggestions for optimizations (or alternative
representations)? It's interesting to note that the difference between
this with no ghc optimization, -O, and -O2 is pretty striking; on my
computer, it's about seven seconds, two seconds, and one second runtime,
respectively.
Abe
---559023410-851401618-1046919164=:9250
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="Life.hs"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.3.96.1030305215244.9250B@college.antioch-college.edu>
Content-Description:
bW9kdWxlIE1haW4gd2hlcmUNCg0KaW1wb3J0IERhdGEuQXJyYXkuSUFycmF5
DQppbXBvcnQgRGF0YS5BcnJheS5VbmJveGVkDQppbXBvcnQgRGF0YS5JeA0K
aW1wb3J0IFN5c3RlbS5SYW5kb20NCg0KdHlwZSBHcmlkID0gVUFycmF5IChJ
bnQsIEludCkgSW50DQoNCnJhbmRvbUdyaWQgOjogKFJhbmRvbUdlbiBnKSA9
PiBnIC0+IEludCAtPiBHcmlkDQpyYW5kb21HcmlkIGcgcyA9IGxpc3RBcnJh
eSBiICQgbWFwIChceCAtPiBpZiB4IHRoZW4gMSBlbHNlIDApICQgdGFrZSAo
cmFuZ2VTaXplIGIpICQgcmFuZG9tcyBnDQogIHdoZXJlIGIgPSAoKDAsMCks
KHMtMSxzLTEpKQ0KDQpnZXRDZWxsIDo6IEdyaWQgLT4gKEludCwgSW50KSAt
PiBJbnQNCmdldENlbGwgZyBjQCh4LHkpID0gaWYgKHggPCB4bWluKSB8fCAo
eCA+IHhtYXgpIHx8ICh5IDwgeW1pbikgfHwgKHkgPj0geW1heCkgdGhlbiAw
IGVsc2UgZyAhIGMNCiAgd2hlcmU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