Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!agate!ucbvax!SOPHIST.UCHICAGO.EDU!goer From: goer@SOPHIST.UCHICAGO.EDU (Richard Goerwitz) Newsgroups: comp.lang.icon Subject: sets Message-ID: <8907221716.AA27534@sophist.uchicago.edu> Date: 22 Jul 89 17:16:29 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 43 Recently I ran a simple program like this: lineset := set() while line := !&input do { insert(lineset,line) } every write(!lineset) I used it to remove duplicate lines from a file looking like this: stuffofonesort data data data stuffofanothersort data data data stuffofanothersort data data data stuffofonesort data data data When I printed everything out, all the lines begin- ning with stuffofonesort were together; same with stuffofanothersort. However, sorting stopped there. No sorting was done on the data fields (separated by a space from the first field). They were listed in the order in which they were entered into the set. This is a neat feature. By some wild coincidence this sorting order turned out to be very, very useful to me. But why did it turn out that way? Could someone who understands the implementation better help? -Richard P.S. The Xenix 386 implementation of Icon is, by all report, very fast and nice. I am planning on snarfing a copy over soon (as soon as I get some hardware questions nailed down). Before I get all involved with it, I wonder: Has anyone implemented coexpressions and not told us about it? I wish I could say I was competent to write good 386 assem- bler code, but alas.... If someone else is either working on this, or else had done it, I'd really like to know about it.