prodcons.mlton

Stephen Weeks MLton@sourcelight.com
Sat, 9 Jun 2001 12:51:50 -0700


--uC6KNpsJKv
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit


Attached is prodcons.mlton.  It uses MLton's nonstandard thread package, and so
is not directly portable to SML/NJ.



--uC6KNpsJKv
Content-Type: application/octet-stream
Content-Disposition: attachment;
	filename="prodcons.mlton"
Content-Transfer-Encoding: base64

KCogVHJhbnNsYXRlZCBmcm9tIHByb2Rjb25zLm9jYW1sLiAqKQoKZnVuY3RvciBaIChTOiBzaWcK
CQkgc3RydWN0dXJlIFByaW1pdGl2ZToKCQkgICAgc2lnCgkJICAgICAgIHN0cnVjdHVyZSBUaHJl
YWQ6CgkJCSAgc2lnCgkJCSAgICAgdmFsIGF0b21pY0JlZ2luOiB1bml0IC0+IHVuaXQKCQkJICAg
ICB2YWwgYXRvbWljRW5kOiB1bml0IC0+IHVuaXQKCQkJICBlbmQKCQkgICAgZW5kCgkJIHN0cnVj
dHVyZSBNTHRvbjoKCQkgICAgc2lnCgkJICAgICAgIHN0cnVjdHVyZSBUaHJlYWQ6CgkJCSAgc2ln
CgkJCSAgICAgdHlwZSAnYSB0CgkJCSAgICAgdmFsIG5ldzogKCdhIC0+IHVuaXQpIC0+ICdhIHQK
CQkJICAgICB2YWwgc3dpdGNoOiAoJ2EgdCAtPiAnYiB0ICogJ2IpIC0+ICdhCgkJCSAgZW5kCgkJ
ICAgIGVuZAoJICAgICAgZW5kKSA9CnN0cnVjdAoKb3BlbiBTCgpmdW4gZm9yIChzdGFydCwgc3Rv
cCwgZikgPQogICBsZXQKICAgICAgZnVuIGxvb3AgaSA9CgkgaWYgaSA+IHN0b3AKCSAgICB0aGVu
ICgpCgkgZWxzZSAoZiBpOyBsb29wIChpICsgMSkpCiAgIGluCiAgICAgIGxvb3Agc3RhcnQKICAg
ZW5kCgpzdHJ1Y3R1cmUgUXVldWU6CiAgIHNpZwogICAgICB0eXBlICdhIHQKCi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