strcat.mlton

Stephen Weeks MLton@sourcelight.com
Tue, 12 Jun 2001 19:12:54 -0700


--0ebJCb+6Rp
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit


Here is a new version of strcat.mlton.  It is more like strcat.gcc and
strcat.ocaml in that it uses a mutable buffer onto which strings are added.



--0ebJCb+6Rp
Content-Type: application/octet-stream
Content-Disposition: attachment;
	filename="z.sml"
Content-Transfer-Encoding: base64

ZnVuIGZvciAoc3RhcnQsIHN0b3AsIGYpID0KICAgbGV0CiAgICAgIGZ1biBsb29wIGkgPQoJIGlm
IGkgPiBzdG9wCgkgICAgdGhlbiAoKQoJIGVsc2UgKGYgaTsgbG9vcCAoaSArIDEpKQogICBpbgog
ICAgICBsb29wIHN0YXJ0CiAgIGVuZAoKZnVuIGF0b2kgcyA9IGNhc2UgSW50LmZyb21TdHJpbmcg
cyBvZiBTT01FIG51bSA9PiBudW0gfCBOT05FID0+IDAKZnVuIHByaW50bCBbXSA9IHByaW50ICJc
biIgfCBwcmludGwoaDo6dCkgPSAoIHByaW50IGggOyBwcmludGwgdCApCgp2YWwgc3R1ZmYgPSAi
aGVsbG9cbiIKCnN0cnVjdHVyZSBCdWZmZXI6CiAgIHNpZwogICAgICB0eXBlICdhIHQKCiAgICAg
IHZhbCBhZGQ6ICdhIHQgKiAnYSBhcnJheSAtPiB1bml0CiAgICAgIHZhbCBsZW5ndGg6ICdhIHQg
LT4gaW50CiAgICAgIHZhbCBuZXc6ICdhIC0+ICdhIHQKICAgZW5kID0KICAgc3RydWN0CiAgICAg
IGRhdGF0eXBlICdhIHQgPSBUIG9mIHtkdW1teTogJ2EsCgkJCSAgICBsZW5ndGg6IGludCByZWYs
CgkJCSAgICBlbHRzOiAnYSBhcnJheSByZWZ9CgogICAgICBmdW4gYWRkIChUIHtkdW1teSwgZWx0
cywgbGVuZ3RofSwgYSkgPQoJIGxldAoJICAgIHZhbCBsID0gIWxlbmd0aAoJICAgIHZhbCBlID0g
IW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