[M3devel] STL algorithms? sort/unique?

Jay K jay.krell at cornell.edu
Sun Sep 30 08:06:19 CEST 2012


I believe opinion remains strongly mixed on garbage collection / "managed"etc. There is a lot of "managed" code. There is a lot of "native" code.We all use a lot of both every day.

Modula-3 is actually pretty unusual in being native code and having garbage collection.It is pretty unusual in having optional garbage collection.It is pretty unusual in having optional safety.  C# allows some safety relaxation within "unsafe" blocks.  Like pointer manipulation.
It pains me slightly in Modula-3 to write e.g.
RTIO.PutText("foo " & Fmt.Int(123) & "bar");I've created at least two pieces of garbage.In C++ any temporary strings would be cleaned upright away at a deterministic time.

I'm really torn.C# seems to be a highly "productive" "environment" (the language,the libraries, possibly the IDEs). Perhaps far more than any C++ or Modula-3.I know people who work on kernel drivers. They still use C.

I don't just want UNTRACED OBJECT.I also want stack allocated objects.C++ has them.
class C{  void F1();  virtual void F2();};
void F3(){    C c;}

I think the nearest equivalent in Modula-3 is a stack allocated RECORDwith function pointers.

 - Jay



From: hosking at cs.purdue.edu
Date: Sat, 29 Sep 2012 21:53:30 -0400
To: jay.krell at cornell.edu
CC: m3devel at elegosoft.com
Subject: Re: [M3devel] STL algorithms? sort/unique?

Jay, there is UNTRACED OBJECT in M3 so you can have non-collected objects with methods.The whole notion that you don’t need a collector for non-trivial programs in this day and age is pretty well discredited.  Java has proved that.C# is Microsoft’s response.C++ still has its uses but use of C++ is way down compared to Java and other managed languages (JavaScript, etc.).
On Sep 29, 2012, at 4:25 PM, Jay K <jay.krell at cornell.edu> wrote:There is probably more here you are unaware of. I strongly urge you to read more.

Here are some important points:

1) The complexity of basically everything in STL is documented, part of the interface.The cost of adding to a vector. To a list. To a set.And btw, they specify which container modifications invalidate iterators.

2) The fact that quicksort requires a random access iterator is documented and checked at runtime.

If I try something like:std::list<int> a;std::sort(a.begin(), a.end());

I believe I get a compilation error.Historically maybe not a good one, but it is a popular area to complain about and compiler/library writers have made progress.

There are some holes in the library.For example, binary_search returns a boolean, not the item found. That bothers me.But you are supposed to use lower_bound instead.
It isn't as obvious imho as it should be how to bulk add to containers, and how to bulk add sorted items to a container.

OO certainly shouldn't require heap.This is a failing of Modula-3.The OBJECT/METHOD sytax is decent.Optional garbage collection is good.But I should be able to separate them.Without resorting to putting function pointers in records..which isn't so bad, but the nice thing about "METHOD" (and virtual function pointers) is the implied/automatic/cheap/safe downcast of the "this" pointer. With function pointers in structs/records, you have some chance of not needing a cast, but it is very very common in both C++ and Modula-3 for their to be, again, that implied/automatic/cheap/safe downcast.

I should spend some time applying the STL design to Modula-3 and see if the language supports it. But I'm too busy right now. :(

 - Jay


> To: jay.krell at cornell.edu
> Date: Sat, 29 Sep 2012 13:10:33 -0700
> From: mika at async.caltech.edu
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] STL algorithms? sort/unique?
> 
> 
> Yeah, OK, you could do this with GENERICs as well, by introducing
> a convention. (In fact there is already one, t.iterate.)
> 
> I still say it's a bit of a bug. If you have very generic methods that
> can take different orders of time, then applying quicksort to a data structure
> with high time complexity for those methods won't be very quick at all (except
> to type). It can be very misleading unless you really know how everything 
> hangs together under the covers. I think that's the C/C++ mentality in general...
> 
> (BTW I think C++ is a truly impressive programming language. The way you can do OO 
> programming without using the heap is really impressive. I just don't trust
> myself, or anyone I know, to use it right. When even Stroustrup writes in his book,
> about certain features, "ask an expert if you want to do this" you have to wonder.)
> 
> Jay K writes:
> >--_13e6ee6a-034c-469d-aa83-18379d050866_
> >Content-Type: text/plain; charset="iso-8859-1"
> >Content-Transfer-Encoding: quoted-printable
> >
> > > The separation of algorithms from containers sounds a bit like a bug.
> >It isn't. It is a leap that allows for far greater code reuse. Efficiently.=
> >(You could do it inefficiently with lots of function pointers -- templates =
> >allowfor inlinability. C++ beats C for performance here.)
> >
> >Imagine I have written quicksort.In C++ we have at least the following wort=
> >hwhile "array-like" data structures:
> >
> > The builtin arrays. Like Modula-3 fixed arrays.
> >
> > Arrays you get with new[]. Like Modula-3 open arrays=2C but they don't ex=
> >pose their size.
> >
> > std::vector<>. Like Modula-3 "sequence" -- a simple growable array. Grows=
> > by a constant factor greater than 1 (typically 2)=2C so that long runs of =
> >"appends" are amortized cheap.
> >
> > std::deque<>. More like Modula-3 sequence=2C in that you can amortized ch=
> >eap at/remove from the front or the back. I believe this can be implemented=
> > as simply an "offset array". Element 0 starts in the middle=2C and wheneve=
> >r you grow it=2C you "center" it -- equal gaps at front and back.
> >
> >Now=2C with the iterator/algorithm separation=2C one quicksort implementati=
> >on can be applied to all these types. The input to "quicksort" is "random a=
> >ccess iterators"=2C which is very much like a "pointer"=2C but isn't necess=
> >arily a pointer. It can be incremented=2C decremented=2C added to an intege=
> >r=2C subtracted from another iterator=2C have an integer subtracted from it=
> >=2C dereferenced=2C and assigned and compared with other iterators of the s=
> >ame type -- all constant time fast operations.
> >
> >There are "input iterators" which can=2C roughly speaking=2C only be increm=
> >ented and dereferenced. They are all some containers can expose and all som=
> >e algorithms require -- for example=2C a singly linked list and linear sear=
> >ch.
> >
> >There are "bidirectional iterators" which can=2C roughly speaking=2C only b=
> >e incremented and decremented and dereferenced. Doubly linked lists expose =
> >these.
> >
> >There are "output iterators".They are similar to "input".
> >
> >input streams (cin=2C like stdin) exposes an input iterator.You can copy fr=
> >om it.Copy is another simple reusable algorithm.
> >
> >output streams (cout=2C like stdout) exposes an output iterator.You can cop=
> >y to it.
> >
> >There are many more examples.Of course=2C besides quick sort=2C there is a =
> >stable sort.There is finding sequences.There is binary_search.There is uppe=
> >r_bound/lower_bound/equal_range which are like binary_search.There is uniqu=
> >e.There is partition.Many many more=2C "built in" to the library.That work =
> >with multiple "built in" containers=2C and can work with custom containers =
> >as well.
> >
> >I strongly recommend you read up on this stuff.It is really quite illimunin=
> >ating. Good stuff.Teaches us how to better factor our code.And to strive fo=
> >r better factoring=2C when we find people have invented/discovered such thi=
> >ngs.
> >
> >"Iterators" already do occur in Modula-3 libraries.
> >
> >All I want is a sorted vector that "closely knows" when it is being written=
> > vs. read=2C and when there are a series of writes with no intervening read=
> >s=2C it can amortize down the cost of maintaining the ordering.
> >
> >I hand coded something.It took me a while to get it to work due to stupid s=
> >mall details.The result is significantly worse than I would have gotten in =
> >C++.Bigger code. Slower code. More copies. More heap allocations.I can elim=
> >inate one of the allocations by merging the next step.But in C++ I naturall=
> >y wouldn't have had it anyway.Not great.
> >
> > - Jay
> >
> >
> >> To: jay.krell at cornell.edu
> >> CC: mika at async.caltech.edu=3B m3devel at elegosoft.com
> >> Subject: Re: [M3devel] STL algorithms? sort/unique?
> >> Date: Sat=2C 29 Sep 2012 11:29:48 -0700
> >> From: mika at async.caltech.edu
> >>=20
> >>=20
> >> Well that depends on how you maintain the vector=2C no?
> >>=20
> >> SortedTable uses "treaps" which are supposed to be good data structures.
> >> Too new to have made it into Knuth=2C last I checked. The amortized cost
> >> of your operations shouldn't be much worse than with your method=2C with
> >> the additional benefit that the sorted order is maintained dynamically.
> >>=20
> >> The separation of algorithms from containers sounds a bit like a bug.
> >> You have to be careful so you don't shoot yourself in the foot there!
> >> (Sorting a list using an algorithm that randomly accesses elements=2C
> >> say...)
> >>=20
> >> The Modula-3 approach is that you figure out what you want to do=2C pick
> >> the ADT you want that provides the minimal set of operations=2C import
> >> that interface=2C then instantiate a more carefully chosen implementation
> >> of the ADT. The language itself obviously can be coaxed into supporting =
> >the
> >> algorithm/data structure separation but no one uses it that way as
> >> far as I know. (Modula-3 generics are not that well explored=2C actually=
> >.
> >> I suspect there are many things you can do with them that no one has
> >> tried.)
> >>=20
> >> Mika
> >>=20
> >> Jay K writes:
> >> >--_7877d7e8-cb4a-4989-bdcd-d406e5b1f51f_
> >> >Content-Type: text/plain=3B charset=3D"iso-8859-1"
> >> >Content-Transfer-Encoding: quoted-printable
> >> >
> >> >The following is very efficient:
> >> >
> >> >run through a bunch of records=3D2C picking out one number from some of =
> >thema=3D
> >> >ppend those numbers to a growing vectorsort the vectorunique the vector
> >> >
> >> >sequence allows for random access..but only via a function...or maybe an=
> > it=3D
> >> >erator
> >> >
> >> >STL has this wonderful separation of algorithms from containers=3D2C via=
> > iter=3D
> >> >ators.I suspect very few other libraries do.And it could be that most la=
> >ngu=3D
> >> >ages don't support it.It doesn't appear I can easily sort a sequence=3D2=
> >C unl=3D
> >> >ess I copy the data out into an array -- gross inefficiency.
> >> >
> >> >I've hacked something very manual together..and it is taking forever to =
> >get=3D
> >> > it to work. It turns out I can reasonably well bound the size of the d=
> >ata=3D
> >> >=3D2C so I'm using an open array...and I have to keep track of my positi=
> >on in=3D
> >> >stead of using addhi/push_back.Not happy.At some point I might give up a=
> >nd =3D
> >> >write the backend in C++..at which point I might as well write a C++ fro=
> >nte=3D
> >> >nd anywa.
> >> >
> >> >
> >> >I absolutely do not want a sorted table and unique upon insert.That is m=
> >uch=3D
> >> > less efficient.What I'm describing uses temporarily larger working set =
> >but=3D
> >> > vastly less CPU.An array that gets sorted/uniqued occasionally=3D2C lik=
> >e jus=3D
> >> >t once.And not ongoing maintainence for every single add.
> >> >
> >> >
> >> > - Jay
> >> >
> >> >
> >> >> To: jay.krell at cornell.edu
> >> >> CC: m3devel at elegosoft.com
> >> >> Subject: Re: [M3devel] STL algorithms? sort/unique?
> >> >> Date: Fri=3D2C 28 Sep 2012 01:04:48 -0700
> >> >> From: mika at async.caltech.edu
> >> >>=3D20
> >> >>=3D20
> >> >> BTW I had the same experience when I first started using Modula-3.
> >> >> It was painful to jump through all its hoops=3D2C coming from C=3D2C w=
> >here yo=3D
> >> >u
> >> >> can do whatever you want to whatever bits happen to be sloshing around
> >> >> your machine. C++ from what I have seen mainly lets you do that to
> >> >> more bits in fewer lines of code.
> >> >>=3D20
> >> >> But after a while I really came to appreciate the value of things like=
> > th=3D
> >> >e
> >> >> language's telling me I'm using the wrong data structure instead of
> >> >> just letting me use the same "nice=3D2C terse=3D2C efficient" syntax t=
> >o write
> >> >> a crappy program :-)
> >> >>=3D20
> >> >> mika writes:
> >> >> >You're using the wrong (abstract) data structure if you want sort and=
> > un=3D
> >> >ique.
> >> >> >
> >> >> >A "sequence" is meant to be accessed sequentially...
> >> >> >
> >> >> >Not knowing precisely what you're doing it sounds like you might want=
> > a
> >> >> >SortedTable... you can get unique on insert and access it in increasi=
> >ng
> >> >> >or decreasing order.
> >> >> >
> >> >> > Mika
> >> >> >
> >> >> >Jay K writes:
> >> >> >>--_d2a02ece-d492-410e-88fb-fb53737d7219_
> >> >> >>Content-Type: text/plain=3D3B charset=3D3D"iso-8859-1"
> >> >> >>Content-Transfer-Encoding: quoted-printable
> >> >> >>
> >> >> >> I have an IntSeq.T with a bunch of integers. =3D3D20
> >> >> >> What is a good terse efficient idiom for sort and unique? =3D3=
> >D20
> >> >> >>
> >> >> >> In C++ I would say: vector<int> a=3D3D3B a.push_ba=
> >ck(..=3D
> >> >.)=3D3D3B =3D3D
> >> >> >> a.push_back(...)=3D3D3B std::sort(a.begin()=3D3D2C a.e=
> >nd())=3D
> >> >=3D3D3B =3D3D
> >> >> >> a.resize(std::unique(a.begin()=3D3D2C a.end()) - a.begin())=3D3D3B =
> > =3D
> >> >for (aut=3D3D
> >> >> >>o i =3D3D3D a.begin()=3D3D3B i !=3D3D3D a.end()=3D3D3B ++i) {
> >> >> >> do stuff with *i }=3D3D20
> >> >> >> Nice=3D3D2C terse=3D3D2C efficient. In Modula-3? =3D3D2=
> >0
> >> >> >>
> >> >> >>I know that unique is one of the easiest algorithms to manually writ=
> >e i=3D
> >> >nlin=3D3D
> >> >> >>e=3D3D2Cbut I shouldn't have to.
> >> >> >>
> >> >> >>(I'm really trying to stay in Modula-3 here=3D3D2C but it is definit=
> >ely a=3D
> >> > strug=3D3D
> >> >> >>gle. :( )
> >> >> >>
> >> >> >>Thank you=3D3D2C - Jay
> >> >> >>
> >> >> >> =3D3D
> >> >> >>
> >> >> >>--_d2a02ece-d492-410e-88fb-fb53737d7219_
> >> >> >>Content-Type: text/html=3D3B charset=3D3D"iso-8859-1"
> >> >> >>Content-Transfer-Encoding: quoted-printable
> >> >> >>
> >> >> >><html>
> >> >> >><head>
> >> >> >><style><!--
> >> >> >>.hmmessage P
> >> >> >>{
> >> >> >>margin:0px=3D3D3B
> >> >> >>padding:0px
> >> >> >>}
> >> >> >>body.hmmessage
> >> >> >>{
> >> >> >>font-size: 12pt=3D3D3B
> >> >> >>font-family:Calibri
> >> >> >>}
> >> >> >>--></style></head>
> >> >> >><body class=3D3D3D'hmmessage'><div dir=3D3D3D'ltr'>&nbsp=3D3D3B &nbs=
> >p=3D3D3B&nb=3D
> >> >sp=3D3D3BI have =3D3D
> >> >> >>an IntSeq.T with a bunch of integers.&nbsp=3D3D3B &nbsp=3D3D3B&nbsp=
> >=3D3D3B<br=3D
> >> >><div><spa=3D3D
> >> >> >>n style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B &nbsp=3D3D3B</s=
> >pan><span s=3D
> >> >tyle=3D3D3D"font=3D3D
> >> >> >>-size: 12pt=3D3D3B ">&nbsp=3D3D3B</span>What is a good terse efficie=
> >nt idio=3D
> >> >m for so=3D3D
> >> >> >>rt and unique?<span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D=
> >3B &nbsp=3D
> >> >=3D3D3B</span><=3D3D
> >> >> >>span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B</span></div>=
> ><div><br>=3D
> >> ></div><div=3D3D
> >> >> >>><br></div><div>&nbsp=3D3D3B &nbsp=3D3D3B In C++ I would say:<span s=
> >tyle=3D3D=3D
> >> >3D"font-si=3D3D
> >> >> >>ze: 12pt=3D3D3B ">&nbsp=3D3D3B &nbsp=3D3D3B</span><span style=3D3D3D=
> >"font-size:=3D
> >> > 12pt=3D3D3B ">&=3D3D
> >> >> >>nbsp=3D3D3B</span></div><div><span style=3D3D3D"font-size: 12pt=3D3D=
> >3B ">&nbs=3D
> >> >p=3D3D3B &nbsp=3D3D
> >> >> >>=3D3D3B</span><span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D=
> >3B</span>ve=3D
> >> >ctor&lt=3D3D3Bin=3D3D
> >> >> >>t&gt=3D3D3B a=3D3D3B<span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbs=
> >p=3D3D3B &nbs=3D
> >> >p=3D3D3B</span><sp=3D3D
> >> >> >>an style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B</span></div><d=
> >iv><span =3D
> >> >style=3D3D3D"f=3D3D
> >> >> >>ont-size: 12pt=3D3D3B ">&nbsp=3D3D3B &nbsp=3D3D3B</span><span style=
> >=3D3D3D"font=3D
> >> >-size: 12pt=3D3D
> >> >> >>=3D3D3B ">&nbsp=3D3D3B</span>a.push_back(...)=3D3D3B<span style=3D3D=
> >3D"font-siz=3D
> >> >e: 12pt=3D3D3B "=3D3D
> >> >> >>>&nbsp=3D3D3B &nbsp=3D3D3B</span><span style=3D3D3D"font-size: 12pt=
> >=3D3D3B ">&n=3D
> >> >bsp=3D3D3B</span=3D3D
> >> >> >>></div><div><div><span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=
> >=3D3D3B &nb=3D
> >> >sp=3D3D3B</spa=3D3D
> >> >> >>n><span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B</span>a.p=
> >ush_back(=3D
> >> >...)=3D3D3B<sp=3D3D
> >> >> >>an style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B &nbsp=3D3D3B</=
> >span><span =3D
> >> >style=3D3D3D"fon=3D3D
> >> >> >>t-size: 12pt=3D3D3B ">&nbsp=3D3D3B</span></div><div><span style=3D3D=
> >3D"font-s=3D
> >> >ize: 12pt=3D3D
> >> >> >>=3D3D3B ">&nbsp=3D3D3B &nbsp=3D3D3B</span><span style=3D3D3D"font-si=
> >ze: 12pt=3D3D=3D
> >> >3B ">&nbsp=3D3D3B<=3D3D
> >> >> >>/span>std::sort(a.begin()=3D3D2C a.end())=3D3D3B<span style=3D3D3D"f=
> >ont-size:=3D
> >> > 12pt=3D3D3B "=3D3D
> >> >> >>>&nbsp=3D3D3B &nbsp=3D3D3B</span><span style=3D3D3D"font-size: 12pt=
> >=3D3D3B ">&n=3D
> >> >bsp=3D3D3B</span=3D3D
> >> >> >>></div><div><span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B=
> > &nbsp=3D3D=3D
> >> >3B</span><sp=3D3D
> >> >> >>an style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B</span>a.resize=
> >(std::uni=3D
> >> >que(a.begi=3D3D
> >> >> >>n()=3D3D2C a.end()) - a.begin())=3D3D3B<span style=3D3D3D"font-size:=
> > 12pt=3D3D3=3D
> >> >B ">&nbsp=3D3D3B=3D3D
> >> >> >> &nbsp=3D3D3B</span><span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbs=
> >p=3D3D3B</s=3D
> >> >pan></div><d=3D3D
> >> >> >>iv><span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B &nbsp=3D=
> >3D3B for (a=3D
> >> >uto i =3D3D3D a.=3D3D
> >> >> >>begin()=3D3D3B i !=3D3D3D a.end()=3D3D3B ++i)</span></div><div><span=
> > style=3D3D=3D
> >> >3D"font-size=3D3D
> >> >> >>: 12pt=3D3D3B ">&nbsp=3D3D3B &nbsp=3D3D3B {<br>&nbsp=3D3D3B &nbsp=3D=
> >3D3B &nbsp=3D3D=3D
> >> >3B do stuff with=3D3D
> >> >> >> *i</span></div><div><span style=3D3D3D"font-size: 12pt=3D3D3B ">&nb=
> >sp=3D3D3B=3D
> >> > &nbsp=3D3D3B =3D3D
> >> >> >>}</span></div><div>&nbsp=3D3D3B</div><div><br></div><div><span style=
> >=3D3D3D=3D
> >> >"font-si=3D3D
> >> >> >>ze: 12pt=3D3D3B ">&nbsp=3D3D3B &nbsp=3D3D3B</span><span style=3D3D3D=
> >"font-size:=3D
> >> > 12pt=3D3D3B ">&=3D3D
> >> >> >>nbsp=3D3D3B</span>Nice=3D3D2C terse=3D3D2C efficient.<span style=3D3=
> >D3D"font-si=3D
> >> >ze: 12pt=3D3D3B =3D3D
> >> >> >>">&nbsp=3D3D3B &nbsp=3D3D3B</span><span style=3D3D3D"font-size: 12pt=
> >=3D3D3B ">&=3D
> >> >nbsp=3D3D3B</spa=3D3D
> >> >> >>n></div><div><span style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3=
> >B &nbsp=3D
> >> >=3D3D3B</span><s=3D3D
> >> >> >>pan style=3D3D3D"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B</span>In Modu=
> >la-3?<spa=3D
> >> >n style=3D3D3D=3D3D
> >> >> >>"font-size: 12pt=3D3D3B ">&nbsp=3D3D3B &nbsp=3D3D3B</span><span styl=
> >e=3D3D3D"fo=3D
> >> >nt-size: 12p=3D3D
> >> >> >>t=3D3D3B ">&nbsp=3D3D3B</span></div><div><br></div><div><br></div><d=
> >iv>I kn=3D
> >> >ow that =3D3D
> >> >> >>unique is one of the easiest algorithms to manually write inline=3D3=
> >D2C</=3D
> >> >div><d=3D3D
> >> >> >>iv>but I shouldn't have to.</div><div><br></div><div><br></div><div>=
> >(I'=3D
> >> >m re=3D3D
> >> >> >>ally trying to stay in Modula-3 here=3D3D2C but it is definitely a s=
> >trugg=3D
> >> >le. :(=3D3D
> >> >> >> )</div><div><br></div><div><br></div><div>Thank you=3D3D2C</div><di=
> >v>&nb=3D
> >> >sp=3D3D3B-=3D3D
> >> >> >> Jay</div><br><br></div> </div></body>
> >> >> >></html>=3D3D
> >> >> >>
> >> >> >>--_d2a02ece-d492-410e-88fb-fb53737d7219_--
> >> > =3D
> >> >
> >> >--_7877d7e8-cb4a-4989-bdcd-d406e5b1f51f_
> >> >Content-Type: text/html=3B charset=3D"iso-8859-1"
> >> >Content-Transfer-Encoding: quoted-printable
> >> >
> >> ><html>
> >> ><head>
> >> ><style><!--
> >> >.hmmessage P
> >> >{
> >> >margin:0px=3D3B
> >> >padding:0px
> >> >}
> >> >body.hmmessage
> >> >{
> >> >font-size: 12pt=3D3B
> >> >font-family:Calibri
> >> >}
> >> >--></style></head>
> >> ><body class=3D3D'hmmessage'><div dir=3D3D'ltr'><div><span style=3D3D"fon=
> >t-size: 1=3D
> >> >2pt=3D3B ">The following is very efficient:</span></div><div><br></div><=
> >div><=3D
> >> >br></div><div>run through a bunch of records=3D2C picking out one number=
> > from=3D
> >> > some of them</div><div>append those numbers to a growing vector</div><d=
> >iv>=3D
> >> >sort the vector</div><div>unique the vector</div><div><br></div><div><br=
> >></=3D
> >> >div><div>sequence allows for random access..but only via a function...</=
> >div=3D
> >> >><div>or maybe an iterator</div><div><br></div><div><br></div><div>STL h=
> >as =3D
> >> >this wonderful separation of algorithms from containers=3D2C via iterato=
> >rs.</=3D
> >> >div><div>I suspect very few other libraries do.</div><div>And it could b=
> >e t=3D
> >> >hat most languages don't support it.</div><div>It doesn't appear I can e=
> >asi=3D
> >> >ly sort a sequence=3D2C unless I copy the data out into an array -- gros=
> >s ine=3D
> >> >fficiency.</div><div><br></div><div><br></div><div>I've hacked something=
> > ve=3D
> >> >ry manual together..and it is taking forever to get it to work.</div><di=
> >v>&=3D
> >> >nbsp=3D3B It turns out I can reasonably well bound the size of the data=
> >=3D2C so=3D
> >> > I'm using an open array...and I have to keep track of my position inste=
> >ad =3D
> >> >of using addhi/push_back.</div><div>Not happy.</div><div>At some point I=
> > mi=3D
> >> >ght give up and write the backend in C++..at which point I might as well=
> > wr=3D
> >> >ite a C++ frontend anywa.</div><div><br></div><div><br></div><div><br></=
> >div=3D
> >> >><div>I absolutely do not want a sorted table and unique upon insert.</d=
> >iv>=3D
> >> ><div>That is much less efficient.</div><div>What I'm describing uses tem=
> >por=3D
> >> >arily larger working set but vastly less CPU.</div><div>An array that ge=
> >ts =3D
> >> >sorted/uniqued occasionally=3D2C like just once.</div><div>And not ongoi=
> >ng ma=3D
> >> >intainence for every single add.</div><div><br></div><div><br></div><div=
> >><b=3D
> >> >r></div><div>&nbsp=3D3B- Jay</div><div><br><br><br><div><div id=3D3D"Sky=
> >DrivePl=3D
> >> >aceholder"></div>&gt=3D3B To: jay.krell at cornell.edu<br>&gt=3D3B CC: m3de=
> >vel at ele=3D
> >> >gosoft.com<br>&gt=3D3B Subject: Re: [M3devel] STL algorithms? sort/uniqu=
> >e?<br=3D
> >> >>&gt=3D3B Date: Fri=3D2C 28 Sep 2012 01:04:48 -0700<br>&gt=3D3B From: mi=
> >ka at async.=3D
> >> >caltech.edu<br>&gt=3D3B <br>&gt=3D3B <br>&gt=3D3B BTW I had the same exp=
> >erience w=3D
> >> >hen I first started using Modula-3.<br>&gt=3D3B It was painful to jump t=
> >hroug=3D
> >> >h all its hoops=3D2C coming from C=3D2C where you<br>&gt=3D3B can do wha=
> >tever you=3D
> >> > want to whatever bits happen to be sloshing around<br>&gt=3D3B your mac=
> >hine.=3D
> >> > C++ from what I have seen mainly lets you do that to<br>&gt=3D3B more =
> >bits =3D
> >> >in fewer lines of code.<br>&gt=3D3B <br>&gt=3D3B But after a while I rea=
> >lly cam=3D
> >> >e to appreciate the value of things like the<br>&gt=3D3B language's tell=
> >ing m=3D
> >> >e I'm using the wrong data structure instead of<br>&gt=3D3B just letting=
> > me u=3D
> >> >se the same "nice=3D2C terse=3D2C efficient" syntax to write<br>&gt=3D3B=
> > a crappy=3D
> >> > program :-)<br>&gt=3D3B <br>&gt=3D3B mika writes:<br>&gt=3D3B &gt=3D3BY=
> >ou're using=3D
> >> > the wrong (abstract) data structure if you want sort and unique.<br>&gt=
> >=3D3B=3D
> >> > &gt=3D3B<br>&gt=3D3B &gt=3D3BA "sequence" is meant to be accessed seque=
> >ntially..=3D
> >> >.<br>&gt=3D3B &gt=3D3B<br>&gt=3D3B &gt=3D3BNot knowing precisely what yo=
> >u're doing =3D
> >> >it sounds like you might want a<br>&gt=3D3B &gt=3D3BSortedTable... you c=
> >an get =3D
> >> >unique on insert and access it in increasing<br>&gt=3D3B &gt=3D3Bor decr=
> >easing =3D
> >> >order.<br>&gt=3D3B &gt=3D3B<br>&gt=3D3B &gt=3D3B Mika<br>&gt=3D3B &gt=
> >=3D3B<br>&gt=3D3B=3D
> >> > &gt=3D3BJay K writes:<br>&gt=3D3B &gt=3D3B&gt=3D3B--_d2a02ece-d492-410e=
> >-88fb-fb537=3D
> >> >37d7219_<br>&gt=3D3B &gt=3D3B&gt=3D3BContent-Type: text/plain=3D3B chars=
> >et=3D3D"iso-8=3D
> >> >859-1"<br>&gt=3D3B &gt=3D3B&gt=3D3BContent-Transfer-Encoding: quoted-pri=
> >ntable<br=3D
> >> >>&gt=3D3B &gt=3D3B&gt=3D3B<br>&gt=3D3B &gt=3D3B&gt=3D3B I have an Int=
> >Seq.T with a bu=3D
> >> >nch of integers. =3D3D20<br>&gt=3D3B &gt=3D3B&gt=3D3B What is a goo=
> >d terse eff=3D
> >> >icient idiom for sort and unique? =3D3D20<br>&gt=3D3B &gt=3D3B&gt=3D3B=
> ><br>&gt=3D3B =3D
> >> >&gt=3D3B&gt=3D3B In C++ I would say: vector&lt=3D3Bint&gt=3D3B=
> > a=3D3D3B =3D
> >> > a.push_back(...)=3D3D3B =3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3B a.p=
> >ush_back(...)=3D
> >> >=3D3D3B std::sort(a.begin()=3D3D2C a.end())=3D3D3B =3D3D<br=
> >>&gt=3D3B &gt=3D
> >> >=3D3B&gt=3D3B a.resize(std::unique(a.begin()=3D3D2C a.end()) - a.begin()=
> >)=3D3D3B =3D
> >> > for (aut=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bo i =3D3D3D a.begin()=3D3=
> >D3B i !=3D3D3D a.=3D
> >> >end()=3D3D3B ++i) {<br>&gt=3D3B &gt=3D3B&gt=3D3B do stuff with *=
> >i }=3D3D20=3D
> >> ><br>&gt=3D3B &gt=3D3B&gt=3D3B Nice=3D3D2C terse=3D3D2C efficient. =
> > In Modula=3D
> >> >-3? =3D3D20<br>&gt=3D3B &gt=3D3B&gt=3D3B<br>&gt=3D3B &gt=3D3B&gt=3D3BI=
> > know that unique=3D
> >> > is one of the easiest algorithms to manually write inlin=3D3D<br>&gt=3D=
> >3B &gt=3D
> >> >=3D3B&gt=3D3Be=3D3D2Cbut I shouldn't have to.<br>&gt=3D3B &gt=3D3B&gt=3D=
> >3B<br>&gt=3D3B &g=3D
> >> >t=3D3B&gt=3D3B(I'm really trying to stay in Modula-3 here=3D3D2C but it =
> >is defini=3D
> >> >tely a strug=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bgle. :( )<br>&gt=3D3B &gt=
> >=3D3B&gt=3D3B<br>&=3D
> >> >gt=3D3B &gt=3D3B&gt=3D3BThank you=3D3D2C - Jay<br>&gt=3D3B &gt=3D3B&gt=
> >=3D3B<br>&gt=3D3B &gt=3D
> >> >=3D3B&gt=3D3B =3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3B<br>&gt=3D3B =
> >&gt=3D3B&gt=3D3B--_d2=3D
> >> >a02ece-d492-410e-88fb-fb53737d7219_<br>&gt=3D3B &gt=3D3B&gt=3D3BContent-=
> >Type: tex=3D
> >> >t/html=3D3B charset=3D3D"iso-8859-1"<br>&gt=3D3B &gt=3D3B&gt=3D3BContent=
> >-Transfer-Enc=3D
> >> >oding: quoted-printable<br>&gt=3D3B &gt=3D3B&gt=3D3B<br>&gt=3D3B &gt=3D3=
> >B&gt=3D3B&lt=3D3B=3D
> >> >html&gt=3D3B<br>&gt=3D3B &gt=3D3B&gt=3D3B&lt=3D3Bhead&gt=3D3B<br>&gt=3D3=
> >B &gt=3D3B&gt=3D3B&lt=3D
> >> >=3D3Bstyle&gt=3D3B&lt=3D3B!--<br>&gt=3D3B &gt=3D3B&gt=3D3B.hmmessage P<b=
> >r>&gt=3D3B &gt=3D3B=3D
> >> >&gt=3D3B{<br>&gt=3D3B &gt=3D3B&gt=3D3Bmargin:0px=3D3D3B<br>&gt=3D3B &gt=
> >=3D3B&gt=3D3Bpadding=3D
> >> >:0px<br>&gt=3D3B &gt=3D3B&gt=3D3B}<br>&gt=3D3B &gt=3D3B&gt=3D3Bbody.hmme=
> >ssage<br>&gt=3D3B=3D
> >> > &gt=3D3B&gt=3D3B{<br>&gt=3D3B &gt=3D3B&gt=3D3Bfont-size: 12pt=3D3D3B<br=
> >>&gt=3D3B &gt=3D3B&=3D
> >> >gt=3D3Bfont-family:Calibri<br>&gt=3D3B &gt=3D3B&gt=3D3B}<br>&gt=3D3B &gt=
> >=3D3B&gt=3D3B--&g=3D
> >> >t=3D3B&lt=3D3B/style&gt=3D3B&lt=3D3B/head&gt=3D3B<br>&gt=3D3B &gt=3D3B&g=
> >t=3D3B&lt=3D3Bbody cl=3D
> >> >ass=3D3D3D'hmmessage'&gt=3D3B&lt=3D3Bdiv dir=3D3D3D'ltr'&gt=3D3B&amp=3D3=
> >Bnbsp=3D3D3B &amp=3D
> >> >=3D3Bnbsp=3D3D3B&amp=3D3Bnbsp=3D3D3BI have =3D3D<br>&gt=3D3B &gt=3D3B&gt=
> >=3D3Ban IntSeq.T wi=3D
> >> >th a bunch of integers.&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&amp=3D3=
> >Bnbsp=3D3D3B&lt=3D
> >> >=3D3Bbr&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bspa=3D3D<br>&gt=3D3B &gt=3D3B&=
> >gt=3D3Bn style=3D3D3D"f=3D
> >> >ont-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B=
> >&lt=3D3B/span&gt=3D
> >> >=3D3B&lt=3D3Bspan style=3D3D3D"font=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3B-si=
> >ze: 12pt=3D3D3B "&g=3D
> >> >t=3D3B&amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3BWhat is a good terse effi=
> >cient idiom f=3D
> >> >or so=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Brt and unique?&lt=3D3Bspan style=
> >=3D3D3D"font-siz=3D
> >> >e: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3=
> >B/span&gt=3D3B&lt=3D
> >> >=3D3B=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bspan style=3D3D3D"font-size: 12pt=
> >=3D3D3B "&gt=3D3B&a=3D
> >> >mp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&g=
> >t=3D3B&lt=3D3Bbr&gt=3D
> >> >=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3B&g=
> >t=3D3B&lt=3D3Bbr&gt=3D3B&=3D
> >> >lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=
> >=3D3D3B In C++ I wo=3D
> >> >uld say:&lt=3D3Bspan style=3D3D3D"font-si=3D3D<br>&gt=3D3B &gt=3D3B&gt=
> >=3D3Bze: 12pt=3D3D3=3D
> >> >B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3=
> >B&lt=3D3Bspan style=3D
> >> >=3D3D3D"font-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3B=3D3D<br>&gt=3D3B &gt=
> >=3D3B&gt=3D3Bnbsp=3D3D3=3D
> >> >B&lt=3D3B/span&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bspa=
> >n style=3D3D3D"font=3D
> >> >-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D<br>&=
> >gt=3D3B &gt=3D3B&gt=3D
> >> >=3D3B=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-size: 12=
> >pt=3D3D3B "&gt=3D3B=3D
> >> >&amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3Bvector&amp=3D3Blt=3D3D3Bin=3D3D=
> ><br>&gt=3D3B &gt=3D3B=3D
> >> >&gt=3D3Bt&amp=3D3Bgt=3D3D3B a=3D3D3B&lt=3D3Bspan style=3D3D3D"font-size:=
> > 12pt=3D3D3B "&gt=3D
> >> >=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B&lt=
> >=3D3Bsp=3D3D<br>&gt=3D3B =3D
> >> >&gt=3D3B&gt=3D3Ban style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3=
> >Bnbsp=3D3D3B&lt=3D
> >> >=3D3B/span&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bspan st=
> >yle=3D3D3D"f=3D3D<br>=3D
> >> >&gt=3D3B &gt=3D3B&gt=3D3Bont-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D=
> >3D3B &amp=3D3Bnbsp=3D
> >> >=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-size: 12pt=3D=
> >3D<br>&gt=3D3B &g=3D
> >> >t=3D3B&gt=3D3B=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B=
> >a.push_back(...)=3D3D=3D
> >> >3B&lt=3D3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "=3D3D<br>&gt=3D3B &g=
> >t=3D3B&gt=3D3B&gt=3D
> >> >=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B&lt=
> >=3D3Bspan style=3D3D3D"=3D
> >> >font-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B&lt=3D3B/span=3D3D<b=
> >r>&gt=3D3B &gt=3D3B=3D
> >> >&gt=3D3B&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bdiv&gt=3D=
> >3B&lt=3D3Bspan style=3D
> >> >=3D3D3D"font-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnb=
> >sp=3D3D3B&lt=3D3B/s=3D
> >> >pa=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bn&gt=3D3B&lt=3D3Bspan style=3D3D3D"f=
> >ont-size: 12pt=3D3D=3D
> >> >3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3Ba.push_back(...)=3D=
> >3D3B&lt=3D3Bsp=3D3D=3D
> >> ><br>&gt=3D3B &gt=3D3B&gt=3D3Ban style=3D3D3D"font-size: 12pt=3D3D3B "&gt=
> >=3D3B&amp=3D3Bnbs=3D
> >> >p=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3Bspan style=3D3=
> >D3D"fon=3D3D<br>&gt=3D
> >> >=3D3B &gt=3D3B&gt=3D3Bt-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B&=
> >lt=3D3B/span&gt=3D3B&=3D
> >> >lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-siz=
> >e: 12pt=3D3D<br>&=3D
> >> >gt=3D3B &gt=3D3B&gt=3D3B=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bn=
> >bsp=3D3D3B&lt=3D3B/span=3D
> >> >&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3D3B&amp=
> >=3D3Bnbsp=3D3D3B&lt=3D
> >> >=3D3B=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3B/span&gt=3D3Bstd::sort(a.begin()=
> >=3D3D2C a.end())=3D
> >> >=3D3D3B&lt=3D3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "=3D3D<br>&gt=3D=
> >3B &gt=3D3B&gt=3D3B=3D
> >> >&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B&l=
> >t=3D3Bspan style=3D3D=3D
> >> >3D"font-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B&lt=3D3B/span=3D3=
> >D<br>&gt=3D3B &gt=3D
> >> >=3D3B&gt=3D3B&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bspan=
> > style=3D3D3D"font-si=3D
> >> >ze: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D=
> >3B/span&gt=3D3B&lt=3D
> >> >=3D3Bsp=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Ban style=3D3D3D"font-size: 12pt=
> >=3D3D3B "&gt=3D3B&a=3D
> >> >mp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3Ba.resize(std::unique(a.begi=3D3D<=
> >br>&gt=3D3B &gt=3D
> >> >=3D3B&gt=3D3Bn()=3D3D2C a.end()) - a.begin())=3D3D3B&lt=3D3Bspan style=
> >=3D3D3D"font-size=3D
> >> >: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B=3D3D<br>&gt=3D3B &gt=3D3B&gt=
> >=3D3B &amp=3D3Bnbsp=3D
> >> >=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-size: 12pt=3D=
> >3D3B "&gt=3D3B&am=3D
> >> >p=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bd=3D3D=
> ><br>&gt=3D3B &gt=3D3B&g=3D
> >> >t=3D3Biv&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3D=
> >3B&amp=3D3Bnbsp=3D
> >> >=3D3D3B &amp=3D3Bnbsp=3D3D3B for (auto i =3D3D3D a.=3D3D<br>&gt=3D3B &gt=
> >=3D3B&gt=3D3Bbegin(=3D
> >> >)=3D3D3B i !=3D3D3D a.end()=3D3D3B ++i)&lt=3D3B/span&gt=3D3B&lt=3D3B/div=
> >&gt=3D3B&lt=3D3Bdiv=3D
> >> >&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-size=3D3D<br>&gt=3D3B &gt=3D3B&gt=
> >=3D3B: 12pt=3D3D3B =3D
> >> >"&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B {&lt=3D3Bbr&gt=3D3B&a=
> >mp=3D3Bnbsp=3D3D3B &a=3D
> >> >mp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B do stuff with=3D3D<br>&gt=3D3B &=
> >gt=3D3B&gt=3D3B *i&=3D
> >> >lt=3D3B/span&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bspan =
> >style=3D3D3D"font-s=3D
> >> >ize: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B =3D3=
> >D<br>&gt=3D3B &gt=3D
> >> >=3D3B&gt=3D3B}&lt=3D3B/span&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D=
> >3B&amp=3D3Bnbsp=3D3D3B&=3D
> >> >lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bbr&gt=3D3B&lt=3D3B/div&gt=
> >=3D3B&lt=3D3Bdiv&gt=3D3B=3D
> >> >&lt=3D3Bspan style=3D3D3D"font-si=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bze: 1=
> >2pt=3D3D3B "&gt=3D
> >> >=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B&lt=
> >=3D3Bspan style=3D3D3D"=3D
> >> >font-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3B=3D3D<br>&gt=3D3B &gt=3D3B&gt=
> >=3D3Bnbsp=3D3D3B&lt=3D
> >> >=3D3B/span&gt=3D3BNice=3D3D2C terse=3D3D2C efficient.&lt=3D3Bspan style=
> >=3D3D3D"font-siz=3D
> >> >e: 12pt=3D3D3B =3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3B"&gt=3D3B&amp=3D3Bnbsp=
> >=3D3D3B &amp=3D3Bnbsp=3D
> >> >=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-size: 12pt=3D=
> >3D3B "&gt=3D3B&am=3D
> >> >p=3D3Bnbsp=3D3D3B&lt=3D3B/spa=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bn&gt=3D3B=
> >&lt=3D3B/div&gt=3D3B&lt=3D
> >> >=3D3Bdiv&gt=3D3B&lt=3D3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3D=
> >3B&amp=3D3Bnbsp=3D
> >> >=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3Bs=3D3D<br>&gt=
> >=3D3B &gt=3D3B&gt=3D3Bpan=3D
> >> > style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B&lt=3D=
> >3B/span&gt=3D3BIn=3D
> >> > Modula-3?&lt=3D3Bspan style=3D3D3D=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3B"fo=
> >nt-size: 12pt=3D
> >> >=3D3D3B "&gt=3D3B&amp=3D3Bnbsp=3D3D3B &amp=3D3Bnbsp=3D3D3B&lt=3D3B/span&=
> >gt=3D3B&lt=3D3Bspan s=3D
> >> >tyle=3D3D3D"font-size: 12p=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bt=3D3D3B "&g=
> >t=3D3B&amp=3D3Bnbsp=3D
> >> >=3D3D3B&lt=3D3B/span&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=
> >=3D3Bbr&gt=3D3B&lt=3D3B/d=3D
> >> >iv&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bbr&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=
> >=3D3Bdiv&gt=3D3BI know =3D
> >> >that =3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bunique is one of the easiest algo=
> >rithms to m=3D
> >> >anually write inline=3D3D2C&lt=3D3B/div&gt=3D3B&lt=3D3Bd=3D3D<br>&gt=3D3=
> >B &gt=3D3B&gt=3D3Bi=3D
> >> >v&gt=3D3Bbut I shouldn't have to.&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B=
> >&lt=3D3Bbr&gt=3D
> >> >=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bbr&gt=3D3B&lt=3D3B/d=
> >iv&gt=3D3B&lt=3D3Bdiv&g=3D
> >> >t=3D3B(I'm re=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3Bally trying to stay in Mo=
> >dula-3 here=3D
> >> >=3D3D2C but it is definitely a struggle. :(=3D3D<br>&gt=3D3B &gt=3D3B&gt=
> >=3D3B )&lt=3D3B=3D
> >> >/div&gt=3D3B&lt=3D3Bdiv&gt=3D3B&lt=3D3Bbr&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=
> >=3D3Bdiv&gt=3D3B&lt=3D
> >> >=3D3Bbr&gt=3D3B&lt=3D3B/div&gt=3D3B&lt=3D3Bdiv&gt=3D3BThank you=3D3D2C&l=
> >t=3D3B/div&gt=3D3B&lt=3D
> >> >=3D3Bdiv&gt=3D3B&amp=3D3Bnbsp=3D3D3B-=3D3D<br>&gt=3D3B &gt=3D3B&gt=3D3B =
> >Jay&lt=3D3B/div&gt=3D3B=3D
> >> >&lt=3D3Bbr&gt=3D3B&lt=3D3Bbr&gt=3D3B&lt=3D3B/div&gt=3D3B &lt=
> >=3D3B/div&gt=3D3B&lt=3D
> >> >=3D3B/body&gt=3D3B<br>&gt=3D3B &gt=3D3B&gt=3D3B&lt=3D3B/html&gt=3D3B=3D3=
> >D<br>&gt=3D3B &gt=3D3B&=3D
> >> >gt=3D3B<br>&gt=3D3B &gt=3D3B&gt=3D3B--_d2a02ece-d492-410e-88fb-fb53737d7=
> >219_--<br><=3D
> >> >/div></div> </div></body>
> >> ></html>=3D
> >> >
> >> >--_7877d7e8-cb4a-4989-bdcd-d406e5b1f51f_--
> > =
> >
> >--_13e6ee6a-034c-469d-aa83-18379d050866_
> >Content-Type: text/html; charset="iso-8859-1"
> >Content-Transfer-Encoding: quoted-printable
> >
> ><html>
> ><head>
> ><style><!--
> >.hmmessage P
> >{
> >margin:0px=3B
> >padding:0px
> >}
> >body.hmmessage
> >{
> >font-size: 12pt=3B
> >font-family:Calibri
> >}
> >--></style></head>
> ><body class=3D'hmmessage'><div dir=3D'ltr'><pre style=3D"line-height: 21.81=
> >818199157715px=3B white-space: normal=3B font-size: 15.454545021057129px=3B=
> > background-color: rgb(255=2C 255=2C 255)=3B ">&nbsp=3B&gt=3B The separatio=
> >n of algorithms from containers sounds a bit like a bug.</pre><div><br></di=
> >v>It isn't. It is a leap that allows for far greater code reuse. Efficientl=
> >y.<div>(You could do it inefficiently with lots of function pointers -- tem=
> >plates allow</div><div>for inlinability. C++ beats C for performance here.)=
> ></div><div><div><br></div><div><br></div><div>Imagine I have written quicks=
> >ort.</div><div>In C++ we have at least the following worthwhile "array-like=
> >" data structures:</div><div><br></div><div><br></div><div>&nbsp=3B The bui=
> >ltin arrays. Like Modula-3 fixed arrays.</div><div><br></div><div><br></div=
> >><div>&nbsp=3B Arrays you get with new[]. Like Modula-3 open arrays=2C but =
> >they don't expose their size.</div><div><br></div><div><br></div><div>&nbsp=
> >=3B std::vector&lt=3B&gt=3B. Like Modula-3 "sequence" -- a simple growable =
> >array. Grows by a constant factor greater than 1 (typically 2)=2C so that l=
> >ong runs of "appends" are amortized cheap.</div><div><br></div><div><br></d=
> >iv><div>&nbsp=3B std::deque&lt=3B&gt=3B. More like Modula-3 sequence=2C in =
> >that you can amortized cheap at/remove from the front or the back. I believ=
> >e this can be implemented as simply an "offset array". Element 0 starts in =
> >the middle=2C and whenever you grow it=2C you "center" it -- equal gaps at =
> >front and back.</div><div><br></div><div><br></div><div>Now=2C with the ite=
> >rator/algorithm separation=2C one quicksort implementation can be applied t=
> >o all these types. The input to "quicksort" is "random access iterators"=2C=
> > which is very much like a "pointer"=2C but isn't necessarily a pointer. It=
> > can be incremented=2C decremented=2C added to an integer=2C subtracted fro=
> >m another iterator=2C have an integer subtracted from it=2C dereferenced=2C=
> > and assigned and compared with other iterators of the same type -- all con=
> >stant time fast operations.</div><div><br></div><div><br>There are "input i=
> >terators" which can=2C roughly speaking=2C only be incremented and derefere=
> >nced. They are all some containers can expose and all some algorithms requi=
> >re -- for example=2C a singly linked list and linear search.</div><div><br>=
> ></div><div><br></div><div>There are "bidirectional iterators" which can=2C =
> >roughly speaking=2C only be incremented and decremented and dereferenced. D=
> >oubly linked lists expose these.</div><div><br></div><div><br></div><div>Th=
> >ere are "output iterators".</div><div>They are similar to "input".</div><di=
> >v><br></div><div><br></div><div>input streams (cin=2C like stdin) exposes a=
> >n input iterator.</div><div>You can copy from it.</div><div>Copy is another=
> > simple reusable algorithm.</div><div><br></div><div><br></div><div>output =
> >streams (cout=2C like stdout) exposes an output iterator.</div><div>You can=
> > copy to it.</div><div><br></div><div><br></div><div>There are many more ex=
> >amples.</div><div>Of course=2C besides quick sort=2C there is a stable sort=
> >.</div><div>There is finding sequences.</div><div>There is binary_search.</=
> >div><div>There is upper_bound/lower_bound/equal_range which are like binary=
> >_search.</div><div>There is unique.</div><div>There is partition.</div><div=
> >>Many many more=2C "built in" to the library.</div><div>That work with mult=
> >iple "built in" containers=2C and can work with custom containers as well.<=
> >/div><div><br></div><div><br></div><div>I strongly recommend you read up on=
> > this stuff.</div><div>It is really quite illimuninating. Good stuff.</div>=
> ><div>Teaches us how to better factor our code.</div><div>And to strive for =
> >better factoring=2C when we find people have invented/discovered such thing=
> >s.</div><div><br></div><div><br></div><div>"Iterators" already do occur in =
> >Modula-3 libraries.</div><div><br></div><div><br></div><div>All I want is a=
> > sorted vector that "closely knows" when it is being written vs. read=2C an=
> >d when there are a series of writes with no intervening reads=2C it can amo=
> >rtize down the cost of maintaining the ordering.</div><div><br></div><div><=
> >br></div><div>I hand coded something.</div><div>It took me a while to get i=
> >t to work due to stupid small details.</div><div>The result is significantl=
> >y worse than I would have gotten in C++.</div><div>Bigger code. Slower code=
> >. More copies. More heap allocations.</div><div>I can eliminate one of the =
> >allocations by merging the next step.</div><div>But in C++ I naturally woul=
> >dn't have had it anyway.</div><div>Not great.</div><div><br></div><div><br>=
> ></div><div>&nbsp=3B- Jay<br><br><br><div><div id=3D"SkyDrivePlaceholder"></=
> >div>&gt=3B To: jay.krell at cornell.edu<br>&gt=3B CC: mika at async.caltech.edu=
> >=3B m3devel at elegosoft.com<br>&gt=3B Subject: Re: [M3devel] STL algorithms? =
> >sort/unique?<br>&gt=3B Date: Sat=2C 29 Sep 2012 11:29:48 -0700<br>&gt=3B Fr=
> >om: mika at async.caltech.edu<br>&gt=3B <br>&gt=3B <br>&gt=3B Well that depend=
> >s on how you maintain the vector=2C no?<br>&gt=3B <br>&gt=3B SortedTable us=
> >es "treaps" which are supposed to be good data structures.<br>&gt=3B Too ne=
> >w to have made it into Knuth=2C last I checked. The amortized cost<br>&gt=
> >=3B of your operations shouldn't be much worse than with your method=2C wit=
> >h<br>&gt=3B the additional benefit that the sorted order is maintained dyna=
> >mically.<br>&gt=3B <br>&gt=3B The separation of algorithms from containers =
> >sounds a bit like a bug.<br>&gt=3B You have to be careful so you don't shoo=
> >t yourself in the foot there!<br>&gt=3B (Sorting a list using an algorithm =
> >that randomly accesses elements=2C<br>&gt=3B say...)<br>&gt=3B <br>&gt=3B T=
> >he Modula-3 approach is that you figure out what you want to do=2C pick<br>=
> >&gt=3B the ADT you want that provides the minimal set of operations=2C impo=
> >rt<br>&gt=3B that interface=2C then instantiate a more carefully chosen imp=
> >lementation<br>&gt=3B of the ADT. The language itself obviously can be coa=
> >xed into supporting the<br>&gt=3B algorithm/data structure separation but n=
> >o one uses it that way as<br>&gt=3B far as I know. (Modula-3 generics are =
> >not that well explored=2C actually.<br>&gt=3B I suspect there are many thin=
> >gs you can do with them that no one has<br>&gt=3B tried.)<br>&gt=3B <br>&gt=
> >=3B Mika<br>&gt=3B <br>&gt=3B Jay K writes:<br>&gt=3B &gt=3B--_7877d7e=
> >8-cb4a-4989-bdcd-d406e5b1f51f_<br>&gt=3B &gt=3BContent-Type: text/plain=3B =
> >charset=3D"iso-8859-1"<br>&gt=3B &gt=3BContent-Transfer-Encoding: quoted-pr=
> >intable<br>&gt=3B &gt=3B<br>&gt=3B &gt=3BThe following is very efficient:<b=
> >r>&gt=3B &gt=3B<br>&gt=3B &gt=3Brun through a bunch of records=3D2C picking=
> > out one number from some of thema=3D<br>&gt=3B &gt=3Bppend those numbers t=
> >o a growing vectorsort the vectorunique the vector<br>&gt=3B &gt=3B<br>&gt=
> >=3B &gt=3Bsequence allows for random access..but only via a function...or m=
> >aybe an it=3D<br>&gt=3B &gt=3Berator<br>&gt=3B &gt=3B<br>&gt=3B &gt=3BSTL h=
> >as this wonderful separation of algorithms from containers=3D2C via iter=3D=
> ><br>&gt=3B &gt=3Bators.I suspect very few other libraries do.And it could b=
> >e that most langu=3D<br>&gt=3B &gt=3Bages don't support it.It doesn't appea=
> >r I can easily sort a sequence=3D2C unl=3D<br>&gt=3B &gt=3Bess I copy the d=
> >ata out into an array -- gross inefficiency.<br>&gt=3B &gt=3B<br>&gt=3B &gt=
> >=3BI've hacked something very manual together..and it is taking forever to =
> >get=3D<br>&gt=3B &gt=3B it to work. It turns out I can reasonably well bou=
> >nd the size of the data=3D<br>&gt=3B &gt=3B=3D2C so I'm using an open array=
> >...and I have to keep track of my position in=3D<br>&gt=3B &gt=3Bstead of u=
> >sing addhi/push_back.Not happy.At some point I might give up and =3D<br>&gt=
> >=3B &gt=3Bwrite the backend in C++..at which point I might as well write a =
> >C++ fronte=3D<br>&gt=3B &gt=3Bnd anywa.<br>&gt=3B &gt=3B<br>&gt=3B &gt=3B<b=
> >r>&gt=3B &gt=3BI absolutely do not want a sorted table and unique upon inse=
> >rt.That is much=3D<br>&gt=3B &gt=3B less efficient.What I'm describing uses=
> > temporarily larger working set but=3D<br>&gt=3B &gt=3B vastly less CPU.An =
> >array that gets sorted/uniqued occasionally=3D2C like jus=3D<br>&gt=3B &gt=
> >=3Bt once.And not ongoing maintainence for every single add.<br>&gt=3B &gt=
> >=3B<br>&gt=3B &gt=3B<br>&gt=3B &gt=3B - Jay<br>&gt=3B &gt=3B<br>&gt=3B &gt=
> >=3B<br>&gt=3B &gt=3B&gt=3B To: jay.krell at cornell.edu<br>&gt=3B &gt=3B&gt=3B=
> > CC: m3devel at elegosoft.com<br>&gt=3B &gt=3B&gt=3B Subject: Re: [M3devel] ST=
> >L algorithms? sort/unique?<br>&gt=3B &gt=3B&gt=3B Date: Fri=3D2C 28 Sep 201=
> >2 01:04:48 -0700<br>&gt=3B &gt=3B&gt=3B From: mika at async.caltech.edu<br>&gt=
> >=3B &gt=3B&gt=3B=3D20<br>&gt=3B &gt=3B&gt=3B=3D20<br>&gt=3B &gt=3B&gt=3B BT=
> >W I had the same experience when I first started using Modula-3.<br>&gt=3B =
> >&gt=3B&gt=3B It was painful to jump through all its hoops=3D2C coming from =
> >C=3D2C where yo=3D<br>&gt=3B &gt=3Bu<br>&gt=3B &gt=3B&gt=3B can do whatever=
> > you want to whatever bits happen to be sloshing around<br>&gt=3B &gt=3B&gt=
> >=3B your machine. C++ from what I have seen mainly lets you do that to<br>=
> >&gt=3B &gt=3B&gt=3B more bits in fewer lines of code.<br>&gt=3B &gt=3B&gt=
> >=3B=3D20<br>&gt=3B &gt=3B&gt=3B But after a while I really came to apprecia=
> >te the value of things like th=3D<br>&gt=3B &gt=3Be<br>&gt=3B &gt=3B&gt=3B =
> >language's telling me I'm using the wrong data structure instead of<br>&gt=
> >=3B &gt=3B&gt=3B just letting me use the same "nice=3D2C terse=3D2C efficie=
> >nt" syntax to write<br>&gt=3B &gt=3B&gt=3B a crappy program :-)<br>&gt=3B &=
> >gt=3B&gt=3B=3D20<br>&gt=3B &gt=3B&gt=3B mika writes:<br>&gt=3B &gt=3B&gt=3B=
> > &gt=3BYou're using the wrong (abstract) data structure if you want sort an=
> >d un=3D<br>&gt=3B &gt=3Bique.<br>&gt=3B &gt=3B&gt=3B &gt=3B<br>&gt=3B &gt=
> >=3B&gt=3B &gt=3BA "sequence" is meant to be accessed sequentially...<br>&gt=
> >=3B &gt=3B&gt=3B &gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3BNot knowing precisely =
> >what you're doing it sounds like you might want a<br>&gt=3B &gt=3B&gt=3B &g=
> >t=3BSortedTable... you can get unique on insert and access it in increasing=
> ><br>&gt=3B &gt=3B&gt=3B &gt=3Bor decreasing order.<br>&gt=3B &gt=3B&gt=3B &=
> >gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B Mika<br>&gt=3B &gt=3B&gt=3B &gt=3B<b=
> >r>&gt=3B &gt=3B&gt=3B &gt=3BJay K writes:<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=
> >=3B--_d2a02ece-d492-410e-88fb-fb53737d7219_<br>&gt=3B &gt=3B&gt=3B &gt=3B&g=
> >t=3BContent-Type: text/plain=3D3B charset=3D3D"iso-8859-1"<br>&gt=3B &gt=3B=
> >&gt=3B &gt=3B&gt=3BContent-Transfer-Encoding: quoted-printable<br>&gt=3B &g=
> >t=3B&gt=3B &gt=3B&gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B I have an In=
> >tSeq.T with a bunch of integers. =3D3D20<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=
> >=3B What is a good terse efficient idiom for sort and unique? =3D3D20<=
> >br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B =
> >In C++ I would say: vector&lt=3Bint&gt=3B a=3D3D3B a.push_bac=
> >k(..=3D<br>&gt=3B &gt=3B.)=3D3D3B =3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B=
> > a.push_back(...)=3D3D3B std::sort(a.begin()=3D3D2C a.end())=
> >=3D<br>&gt=3B &gt=3B=3D3D3B =3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B=
> > a.resize(std::unique(a.begin()=3D3D2C a.end()) - a.begin())=3D3D3B =
> >=3D<br>&gt=3B &gt=3Bfor (aut=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bo i =
> >=3D3D3D a.begin()=3D3D3B i !=3D3D3D a.end()=3D3D3B ++i) {<br>&gt=3B &gt=
> >=3B&gt=3B &gt=3B&gt=3B do stuff with *i }=3D3D20<br>&gt=3B &gt=3B&g=
> >t=3B &gt=3B&gt=3B Nice=3D3D2C terse=3D3D2C efficient. In Modula-3=
> >? =3D3D20<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=
> >=3B&gt=3BI know that unique is one of the easiest algorithms to manually wr=
> >ite i=3D<br>&gt=3B &gt=3Bnlin=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Be=3D3=
> >D2Cbut I shouldn't have to.<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B<br>&gt=3B &=
> >gt=3B&gt=3B &gt=3B&gt=3B(I'm really trying to stay in Modula-3 here=3D3D2C =
> >but it is definitely a=3D<br>&gt=3B &gt=3B strug=3D3D<br>&gt=3B &gt=3B&gt=
> >=3B &gt=3B&gt=3Bgle. :( )<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B<br>&gt=3B &gt=
> >=3B&gt=3B &gt=3B&gt=3BThank you=3D3D2C - Jay<br>&gt=3B &gt=3B&gt=3B &gt=3B&=
> >gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B =3D3D<br>&gt=3B &gt=3B=
> >&gt=3B &gt=3B&gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B--_d2a02ece-d492-410=
> >e-88fb-fb53737d7219_<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3BContent-Type: text/=
> >html=3D3B charset=3D3D"iso-8859-1"<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3BConte=
> >nt-Transfer-Encoding: quoted-printable<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B<=
> >br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B&lt=3Bhtml&gt=3B<br>&gt=3B &gt=3B&gt=3B =
> >&gt=3B&gt=3B&lt=3Bhead&gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B&lt=3Bstyle=
> >&gt=3B&lt=3B!--<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B.hmmessage P<br>&gt=3B &=
> >gt=3B&gt=3B &gt=3B&gt=3B{<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bmargin:0px=3D3=
> >D3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bpadding:0px<br>&gt=3B &gt=3B&gt=3B &=
> >gt=3B&gt=3B}<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bbody.hmmessage<br>&gt=3B &g=
> >t=3B&gt=3B &gt=3B&gt=3B{<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bfont-size: 12pt=
> >=3D3D3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bfont-family:Calibri<br>&gt=3B &g=
> >t=3B&gt=3B &gt=3B&gt=3B}<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B--&gt=3B&lt=3B/=
> >style&gt=3B&lt=3B/head&gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B&lt=3Bbody =
> >class=3D3D3D'hmmessage'&gt=3B&lt=3Bdiv dir=3D3D3D'ltr'&gt=3B&amp=3Bnbsp=3D3=
> >D3B &amp=3Bnbsp=3D3D3B&amp=3Bnb=3D<br>&gt=3B &gt=3Bsp=3D3D3BI have =3D3D<br=
> >>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Ban IntSeq.T with a bunch of integers.&amp=
> >=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B&amp=3Bnbsp=3D3D3B&lt=3Bbr=3D<br>&gt=3B &g=
> >t=3B&gt=3B&lt=3Bdiv&gt=3B&lt=3Bspa=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B=
> >n style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=
> >=3D3D3B&lt=3B/span&gt=3B&lt=3Bspan s=3D<br>&gt=3B &gt=3Btyle=3D3D3D"font=3D=
> >3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=
> >=3D3D3B&lt=3B/span&gt=3BWhat is a good terse efficient idio=3D<br>&gt=3B &g=
> >t=3Bm for so=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Brt and unique?&lt=3Bsp=
> >an style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbs=
> >p=3D<br>&gt=3B &gt=3B=3D3D3B&lt=3B/span&gt=3B&lt=3B=3D3D<br>&gt=3B &gt=3B&g=
> >t=3B &gt=3B&gt=3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbs=
> >p=3D3D3B&lt=3B/span&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B=3D<b=
> >r>&gt=3B &gt=3B&lt=3B/div&gt=3B&lt=3Bdiv=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B=
> >&gt=3B&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&amp=3Bnbsp=3D3D3B=
> > &amp=3Bnbsp=3D3D3B In C++ I would say:&lt=3Bspan style=3D3D=3D<br>&gt=3B &=
> >gt=3B3D"font-si=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bze: 12pt=3D3D3B "&g=
> >t=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3Bspan style=
> >=3D3D3D"font-size:=3D<br>&gt=3B &gt=3B 12pt=3D3D3B "&gt=3B&amp=3B=3D3D<br>&=
> >gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3B/div&gt=3B=
> >&lt=3Bdiv&gt=3B&lt=3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=
> >=3Bnbs=3D<br>&gt=3B &gt=3Bp=3D3D3B &amp=3Bnbsp=3D3D<br>&gt=3B &gt=3B&gt=3B =
> >&gt=3B&gt=3B=3D3D3B&lt=3B/span&gt=3B&lt=3Bspan style=3D3D3D"font-size: 12pt=
> >=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3Bve=3D<br>&gt=3B &gt=3Bcto=
> >r&amp=3Blt=3D3D3Bin=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bt&amp=3Bgt=3D3D=
> >3B a=3D3D3B&lt=3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbs=
> >p=3D3D3B &amp=3Bnbs=3D<br>&gt=3B &gt=3Bp=3D3D3B&lt=3B/span&gt=3B&lt=3Bsp=3D=
> >3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Ban style=3D3D3D"font-size: 12pt=3D3D3=
> >B "&gt=3B&amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B=
> >&lt=3Bspan =3D<br>&gt=3B &gt=3Bstyle=3D3D3D"f=3D3D<br>&gt=3B &gt=3B&gt=3B &=
> >gt=3B&gt=3Bont-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D=
> >3B&lt=3B/span&gt=3B&lt=3Bspan style=3D3D3D"font=3D<br>&gt=3B &gt=3B-size: 1=
> >2pt=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D=
> >3B&lt=3B/span&gt=3Ba.push_back(...)=3D3D3B&lt=3Bspan style=3D3D3D"font-siz=
> >=3D<br>&gt=3B &gt=3Be: 12pt=3D3D3B "=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=
> >=3B&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3Bspan s=
> >tyle=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bn=3D<br>&gt=3B &gt=3Bbsp=
> >=3D3D3B&lt=3B/span=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B&gt=3B&lt=3B/div=
> >&gt=3B&lt=3Bdiv&gt=3B&lt=3Bdiv&gt=3B&lt=3Bspan style=3D3D3D"font-size: 12pt=
> >=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnb=3D<br>&gt=3B &gt=3Bsp=3D3D3B&lt=
> >=3B/spa=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bn&gt=3B&lt=3Bspan style=3D3=
> >D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3Ba.push=
> >_back(=3D<br>&gt=3B &gt=3B...)=3D3D3B&lt=3Bsp=3D3D<br>&gt=3B &gt=3B&gt=3B &=
> >gt=3B&gt=3Ban style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B=
> > &amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3Bspan =3D<br>&gt=3B &gt=3Bstyle=3D=
> >3D3D"fon=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bt-size: 12pt=3D3D3B "&gt=
> >=3B&amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3B=
> >span style=3D3D3D"font-s=3D<br>&gt=3B &gt=3Bize: 12pt=3D3D<br>&gt=3B &gt=3B=
> >&gt=3B &gt=3B&gt=3B=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B&lt=
> >=3B/span&gt=3B&lt=3Bspan style=3D3D3D"font-size: 12pt=3D3D=3D<br>&gt=3B &gt=
> >=3B3B "&gt=3B&amp=3Bnbsp=3D3D3B&lt=3B=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=
> >=3B/span&gt=3Bstd::sort(a.begin()=3D3D2C a.end())=3D3D3B&lt=3Bspan style=3D=
> >3D3D"font-size:=3D<br>&gt=3B &gt=3B 12pt=3D3D3B "=3D3D<br>&gt=3B &gt=3B&gt=
> >=3B &gt=3B&gt=3B&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B&lt=3B/span&gt=
> >=3B&lt=3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bn=3D<br>&gt=
> >=3B &gt=3Bbsp=3D3D3B&lt=3B/span=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B&gt=
> >=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bspan style=3D3D3D"font-size: 12pt=
> >=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D=3D<br>&gt=3B &gt=3B3B&lt=
> >=3B/span&gt=3B&lt=3Bsp=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Ban style=3D3=
> >D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3Ba.resi=
> >ze(std::uni=3D<br>&gt=3B &gt=3Bque(a.begi=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=
> >=3B&gt=3Bn()=3D3D2C a.end()) - a.begin())=3D3D3B&lt=3Bspan style=3D3D3D"fon=
> >t-size: 12pt=3D3D3=3D<br>&gt=3B &gt=3BB "&gt=3B&amp=3Bnbsp=3D3D3B=3D3D<br>&=
> >gt=3B &gt=3B&gt=3B &gt=3B&gt=3B &amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3Bsp=
> >an style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B&lt=3B/s=3D=
> ><br>&gt=3B &gt=3Bpan&gt=3B&lt=3B/div&gt=3B&lt=3Bd=3D3D<br>&gt=3B &gt=3B&gt=
> >=3B &gt=3B&gt=3Biv&gt=3B&lt=3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=
> >=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B for (a=3D<br>&gt=3B &gt=3Buto i =
> >=3D3D3D a.=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bbegin()=3D3D3B i !=3D3D3=
> >D a.end()=3D3D3B ++i)&lt=3B/span&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3B=
> >span style=3D3D=3D<br>&gt=3B &gt=3B3D"font-size=3D3D<br>&gt=3B &gt=3B&gt=3B=
> > &gt=3B&gt=3B: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B {&l=
> >t=3Bbr&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D=3D<br>&g=
> >t=3B &gt=3B3B do stuff with=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B *i&lt=
> >=3B/span&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bspan style=3D3D3D"font-s=
> >ize: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B=3D<br>&gt=3B &gt=3B &amp=3Bnbsp=
> >=3D3D3B =3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B}&lt=3B/span&gt=3B&lt=3B/d=
> >iv&gt=3B&lt=3Bdiv&gt=3B&amp=3Bnbsp=3D3D3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=
> >=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bspan style=3D3D3D=3D<br>&gt=
> >=3B &gt=3B"font-si=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bze: 12pt=3D3D3B =
> >"&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3Bspan sty=
> >le=3D3D3D"font-size:=3D<br>&gt=3B &gt=3B 12pt=3D3D3B "&gt=3B&amp=3B=3D3D<br=
> >>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bnbsp=3D3D3B&lt=3B/span&gt=3BNice=3D3D2C te=
> >rse=3D3D2C efficient.&lt=3Bspan style=3D3D3D"font-si=3D<br>&gt=3B &gt=3Bze:=
> > 12pt=3D3D3B =3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B"&gt=3B&amp=3Bnbsp=3D=
> >3D3B &amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3Bspan style=3D3D3D"font-size: =
> >12pt=3D3D3B "&gt=3B&amp=3B=3D<br>&gt=3B &gt=3Bnbsp=3D3D3B&lt=3B/spa=3D3D<br=
> >>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bn&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=
> >=3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B &amp=
> >=3Bnbsp=3D<br>&gt=3B &gt=3B=3D3D3B&lt=3B/span&gt=3B&lt=3Bs=3D3D<br>&gt=3B &=
> >gt=3B&gt=3B &gt=3B&gt=3Bpan style=3D3D3D"font-size: 12pt=3D3D3B "&gt=3B&amp=
> >=3Bnbsp=3D3D3B&lt=3B/span&gt=3BIn Modula-3?&lt=3Bspa=3D<br>&gt=3B &gt=3Bn s=
> >tyle=3D3D3D=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B"font-size: 12pt=3D3D3B=
> > "&gt=3B&amp=3Bnbsp=3D3D3B &amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3Bspan st=
> >yle=3D3D3D"fo=3D<br>&gt=3B &gt=3Bnt-size: 12p=3D3D<br>&gt=3B &gt=3B&gt=3B &=
> >gt=3B&gt=3Bt=3D3D3B "&gt=3B&amp=3Bnbsp=3D3D3B&lt=3B/span&gt=3B&lt=3B/div&gt=
> >=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=
> >=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BI kn=3D<br>&gt=3B &gt=3Bow that =3D3D<br>=
> >&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bunique is one of the easiest algorithms to =
> >manually write inline=3D3D2C&lt=3B/=3D<br>&gt=3B &gt=3Bdiv&gt=3B&lt=3Bd=3D3=
> >D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Biv&gt=3Bbut I shouldn't have to.&lt=3B=
> >/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=
> >=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B(I'=3D<br>&gt=3B &gt=3Bm re=3D3D<=
> >br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3Bally trying to stay in Modula-3 here=3D3=
> >D2C but it is definitely a strugg=3D<br>&gt=3B &gt=3Ble. :(=3D3D<br>&gt=3B =
> >&gt=3B&gt=3B &gt=3B&gt=3B )&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=
> >=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BTh=
> >ank you=3D3D2C&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&amp=3Bnb=3D<br>&gt=3B &gt=3Bs=
> >p=3D3D3B-=3D3D<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B Jay&lt=3B/div&gt=3B&lt=
> >=3Bbr&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B &lt=3B/div&gt=3B&lt=3B=
> >/body&gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B&lt=3B/html&gt=3B=3D3D<br>&g=
> >t=3B &gt=3B&gt=3B &gt=3B&gt=3B<br>&gt=3B &gt=3B&gt=3B &gt=3B&gt=3B--_d2a02e=
> >ce-d492-410e-88fb-fb53737d7219_--<br>&gt=3B &gt=3B =3D<br>&gt=3B=
> > &gt=3B<br>&gt=3B &gt=3B--_7877d7e8-cb4a-4989-bdcd-d406e5b1f51f_<br>&gt=3B =
> >&gt=3BContent-Type: text/html=3B charset=3D"iso-8859-1"<br>&gt=3B &gt=3BCon=
> >tent-Transfer-Encoding: quoted-printable<br>&gt=3B &gt=3B<br>&gt=3B &gt=3B&=
> >lt=3Bhtml&gt=3B<br>&gt=3B &gt=3B&lt=3Bhead&gt=3B<br>&gt=3B &gt=3B&lt=3Bstyl=
> >e&gt=3B&lt=3B!--<br>&gt=3B &gt=3B.hmmessage P<br>&gt=3B &gt=3B{<br>&gt=3B &=
> >gt=3Bmargin:0px=3D3B<br>&gt=3B &gt=3Bpadding:0px<br>&gt=3B &gt=3B}<br>&gt=
> >=3B &gt=3Bbody.hmmessage<br>&gt=3B &gt=3B{<br>&gt=3B &gt=3Bfont-size: 12pt=
> >=3D3B<br>&gt=3B &gt=3Bfont-family:Calibri<br>&gt=3B &gt=3B}<br>&gt=3B &gt=
> >=3B--&gt=3B&lt=3B/style&gt=3B&lt=3B/head&gt=3B<br>&gt=3B &gt=3B&lt=3Bbody c=
> >lass=3D3D'hmmessage'&gt=3B&lt=3Bdiv dir=3D3D'ltr'&gt=3B&lt=3Bdiv&gt=3B&lt=
> >=3Bspan style=3D3D"font-size: 1=3D<br>&gt=3B &gt=3B2pt=3D3B "&gt=3BThe foll=
> >owing is very efficient:&lt=3B/span&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=
> >=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3B=3D<br>&gt=3B &gt=3Bbr&gt=
> >=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3Brun through a bunch of records=3D2C picki=
> >ng out one number from=3D<br>&gt=3B &gt=3B some of them&lt=3B/div&gt=3B&lt=
> >=3Bdiv&gt=3Bappend those numbers to a growing vector&lt=3B/div&gt=3B&lt=3Bd=
> >iv&gt=3B=3D<br>&gt=3B &gt=3Bsort the vector&lt=3B/div&gt=3B&lt=3Bdiv&gt=3Bu=
> >nique the vector&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=
> >=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/=3D<br>&gt=3B &gt=3Bdiv&gt=3B&lt=3Bd=
> >iv&gt=3Bsequence allows for random access..but only via a function...&lt=3B=
> >/div=3D<br>&gt=3B &gt=3B&gt=3B&lt=3Bdiv&gt=3Bor maybe an iterator&lt=3B/div=
> >&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&=
> >gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BSTL has =3D<br>&gt=3B &gt=3Bthis wonder=
> >ful separation of algorithms from containers=3D2C via iterators.&lt=3B/=3D<=
> >br>&gt=3B &gt=3Bdiv&gt=3B&lt=3Bdiv&gt=3BI suspect very few other libraries =
> >do.&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BAnd it could be t=3D<br>&gt=3B &gt=3Bhat =
> >most languages don't support it.&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BIt doesn't a=
> >ppear I can easi=3D<br>&gt=3B &gt=3Bly sort a sequence=3D2C unless I copy t=
> >he data out into an array -- gross ine=3D<br>&gt=3B &gt=3Bfficiency.&lt=3B/=
> >div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3B=
> >br&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BI've hacked something ve=3D<br>&gt=
> >=3B &gt=3Bry manual together..and it is taking forever to get it to work.&l=
> >t=3B/div&gt=3B&lt=3Bdiv&gt=3B&amp=3B=3D<br>&gt=3B &gt=3Bnbsp=3D3B It turns =
> >out I can reasonably well bound the size of the data=3D2C so=3D<br>&gt=3B &=
> >gt=3B I'm using an open array...and I have to keep track of my position ins=
> >tead =3D<br>&gt=3B &gt=3Bof using addhi/push_back.&lt=3B/div&gt=3B&lt=3Bdiv=
> >&gt=3BNot happy.&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BAt some point I mi=3D<br>&gt=
> >=3B &gt=3Bght give up and write the backend in C++..at which point I might =
> >as well wr=3D<br>&gt=3B &gt=3Bite a C++ frontend anywa.&lt=3B/div&gt=3B&lt=
> >=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=
> >=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div=3D<br>&gt=3B &gt=3B&gt=
> >=3B&lt=3Bdiv&gt=3BI absolutely do not want a sorted table and unique upon i=
> >nsert.&lt=3B/div&gt=3B=3D<br>&gt=3B &gt=3B&lt=3Bdiv&gt=3BThat is much less =
> >efficient.&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BWhat I'm describing uses tempor=3D=
> ><br>&gt=3B &gt=3Barily larger working set but vastly less CPU.&lt=3B/div&gt=
> >=3B&lt=3Bdiv&gt=3BAn array that gets =3D<br>&gt=3B &gt=3Bsorted/uniqued occ=
> >asionally=3D2C like just once.&lt=3B/div&gt=3B&lt=3Bdiv&gt=3BAnd not ongoin=
> >g ma=3D<br>&gt=3B &gt=3Bintainence for every single add.&lt=3B/div&gt=3B&lt=
> >=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bbr&gt=3B&lt=
> >=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=3Bb=3D<br>&gt=3B &gt=3Br&gt=3B&lt=3B/div&gt=
> >=3B&lt=3Bdiv&gt=3B&amp=3Bnbsp=3D3B- Jay&lt=3B/div&gt=3B&lt=3Bdiv&gt=3B&lt=
> >=3Bbr&gt=3B&lt=3Bbr&gt=3B&lt=3Bbr&gt=3B&lt=3Bdiv&gt=3B&lt=3Bdiv id=3D3D"Sky=
> >DrivePl=3D<br>&gt=3B &gt=3Baceholder"&gt=3B&lt=3B/div&gt=3B&amp=3Bgt=3D3B T=
> >o: jay.krell at cornell.edu&lt=3Bbr&gt=3B&amp=3Bgt=3D3B CC: m3devel at ele=3D<br>=
> >&gt=3B &gt=3Bgosoft.com&lt=3Bbr&gt=3B&amp=3Bgt=3D3B Subject: Re: [M3devel] =
> >STL algorithms? sort/unique?&lt=3Bbr=3D<br>&gt=3B &gt=3B&gt=3B&amp=3Bgt=3D3=
> >B Date: Fri=3D2C 28 Sep 2012 01:04:48 -0700&lt=3Bbr&gt=3B&amp=3Bgt=3D3B Fro=
> >m: mika at async.=3D<br>&gt=3B &gt=3Bcaltech.edu&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &=
> >lt=3Bbr&gt=3B&amp=3Bgt=3D3B &lt=3Bbr&gt=3B&amp=3Bgt=3D3B BTW I had the same=
> > experience w=3D<br>&gt=3B &gt=3Bhen I first started using Modula-3.&lt=3Bb=
> >r&gt=3B&amp=3Bgt=3D3B It was painful to jump throug=3D<br>&gt=3B &gt=3Bh al=
> >l its hoops=3D2C coming from C=3D2C where you&lt=3Bbr&gt=3B&amp=3Bgt=3D3B c=
> >an do whatever you=3D<br>&gt=3B &gt=3B want to whatever bits happen to be s=
> >loshing around&lt=3Bbr&gt=3B&amp=3Bgt=3D3B your machine.=3D<br>&gt=3B &gt=
> >=3B C++ from what I have seen mainly lets you do that to&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B more bits =3D<br>&gt=3B &gt=3Bin fewer lines of code.&lt=3Bbr&gt=
> >=3B&amp=3Bgt=3D3B &lt=3Bbr&gt=3B&amp=3Bgt=3D3B But after a while I really c=
> >am=3D<br>&gt=3B &gt=3Be to appreciate the value of things like the&lt=3Bbr&=
> >gt=3B&amp=3Bgt=3D3B language's telling m=3D<br>&gt=3B &gt=3Be I'm using the=
> > wrong data structure instead of&lt=3Bbr&gt=3B&amp=3Bgt=3D3B just letting m=
> >e u=3D<br>&gt=3B &gt=3Bse the same "nice=3D2C terse=3D2C efficient" syntax =
> >to write&lt=3Bbr&gt=3B&amp=3Bgt=3D3B a crappy=3D<br>&gt=3B &gt=3B program :=
> >-)&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &lt=3Bbr&gt=3B&amp=3Bgt=3D3B mika writes:&lt=
> >=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3BYou're using=3D<br>&gt=3B &gt=3B th=
> >e wrong (abstract) data structure if you want sort and unique.&lt=3Bbr&gt=
> >=3B&amp=3Bgt=3D3B=3D<br>&gt=3B &gt=3B &amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=
> >=3D3B &amp=3Bgt=3D3BA "sequence" is meant to be accessed sequentially..=3D<=
> >br>&gt=3B &gt=3B.&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&lt=3Bbr&gt=3B&=
> >amp=3Bgt=3D3B &amp=3Bgt=3D3BNot knowing precisely what you're doing =3D<br>=
> >&gt=3B &gt=3Bit sounds like you might want a&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &a=
> >mp=3Bgt=3D3BSortedTable... you can get =3D<br>&gt=3B &gt=3Bunique on insert=
> > and access it in increasing&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3Bor d=
> >ecreasing =3D<br>&gt=3B &gt=3Border.&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=
> >=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B Mika&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B=3D<br>&gt=3B &gt=3B &=
> >amp=3Bgt=3D3BJay K writes:&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=
> >=3Bgt=3D3B--_d2a02ece-d492-410e-88fb-fb537=3D<br>&gt=3B &gt=3B37d7219_&lt=
> >=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3BContent-Type: text/pl=
> >ain=3D3B charset=3D3D"iso-8=3D<br>&gt=3B &gt=3B859-1"&lt=3Bbr&gt=3B&amp=3Bg=
> >t=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3BContent-Transfer-Encoding: quoted-printa=
> >ble&lt=3Bbr=3D<br>&gt=3B &gt=3B&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=
> >=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B I have an=
> > IntSeq.T with a bu=3D<br>&gt=3B &gt=3Bnch of integers. =3D3D20&lt=3Bbr&g=
> >t=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B What is a good terse eff=
> >=3D<br>&gt=3B &gt=3Bicient idiom for sort and unique? =3D3D20&lt=3Bbr&gt=
> >=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B =
> >=3D<br>&gt=3B &gt=3B&amp=3Bgt=3D3B&amp=3Bgt=3D3B In C++ I would say: =
> > vector&amp=3Blt=3D3Bint&amp=3Bgt=3D3B a=3D3D3B =3D<br>&gt=3B &gt=3B =
> > a.push_back(...)=3D3D3B =3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B=
> >&amp=3Bgt=3D3B a.push_back(...)=3D<br>&gt=3B &gt=3B=3D3D3B std=
> >::sort(a.begin()=3D3D2C a.end())=3D3D3B =3D3D&lt=3Bbr&gt=3B&amp=3Bgt=
> >=3D3B &amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3Bgt=3D3B a.resize(std::unique=
> >(a.begin()=3D3D2C a.end()) - a.begin())=3D3D3B =3D<br>&gt=3B &gt=3B f=
> >or (aut=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bo i =
> >=3D3D3D a.begin()=3D3D3B i !=3D3D3D a.=3D<br>&gt=3B &gt=3Bend()=3D3D3B ++i)=
> > {&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B do stuf=
> >f with *i }=3D3D20=3D<br>&gt=3B &gt=3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=
> >=3Bgt=3D3B&amp=3Bgt=3D3B Nice=3D3D2C terse=3D3D2C efficient. In M=
> >odula=3D<br>&gt=3B &gt=3B-3? =3D3D20&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bg=
> >t=3D3B&amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D=
> >3BI know that unique=3D<br>&gt=3B &gt=3B is one of the easiest algorithms t=
> >o manually write inlin=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D<br>&gt=
> >=3B &gt=3B=3D3B&amp=3Bgt=3D3Be=3D3D2Cbut I shouldn't have to.&lt=3Bbr&gt=3B=
> >&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &am=
> >p=3Bg=3D<br>&gt=3B &gt=3Bt=3D3B&amp=3Bgt=3D3B(I'm really trying to stay in =
> >Modula-3 here=3D3D2C but it is defini=3D<br>&gt=3B &gt=3Btely a strug=3D3D&=
> >lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bgle. :( )&lt=3Bbr&g=
> >t=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3B=3D<br>=
> >&gt=3B &gt=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3BThank you=3D3D2C - Jay&lt=
> >=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3B=
> >gt=3D3B &amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3Bgt=3D3B =3D3D&l=
> >t=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B--_d2=3D<br>&gt=3B &gt=3Ba02ece-d492=
> >-410e-88fb-fb53737d7219_&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bg=
> >t=3D3BContent-Type: tex=3D<br>&gt=3B &gt=3Bt/html=3D3B charset=3D3D"iso-885=
> >9-1"&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3BContent-Transf=
> >er-Enc=3D<br>&gt=3B &gt=3Boding: quoted-printable&lt=3Bbr&gt=3B&amp=3Bgt=3D=
> >3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&=
> >amp=3Bgt=3D3B&amp=3Blt=3D3B=3D<br>&gt=3B &gt=3Bhtml&amp=3Bgt=3D3B&lt=3Bbr&g=
> >t=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&amp=3Blt=3D3Bhead&amp=3Bgt=
> >=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&amp=3Blt=3D<=
> >br>&gt=3B &gt=3B=3D3Bstyle&amp=3Bgt=3D3B&amp=3Blt=3D3B!--&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B.hmmessage P&lt=3Bbr&gt=3B&amp=3Bgt=
> >=3D3B &amp=3Bgt=3D3B=3D<br>&gt=3B &gt=3B&amp=3Bgt=3D3B{&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bmargin:0px=3D3D3B&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bpadding=3D<br>&gt=3B &gt=3B:0px&lt=
> >=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B}&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bbody.hmmessage&lt=3Bbr&gt=3B&amp=3Bg=
> >t=3D3B=3D<br>&gt=3B &gt=3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B{&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bfont-size: 12pt=3D3D3B&lt=3Bbr&gt=3B=
> >&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3B=3D<br>&gt=3B &gt=3Bgt=3D3Bfont-family:=
> >Calibri&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B}&lt=3Bbr&g=
> >t=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B--&amp=3Bg=3D<br>&gt=3B &gt=
> >=3Bt=3D3B&amp=3Blt=3D3B/style&amp=3Bgt=3D3B&amp=3Blt=3D3B/head&amp=3Bgt=3D3=
> >B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B&amp=3Blt=3D3Bbod=
> >y cl=3D<br>&gt=3B &gt=3Bass=3D3D3D'hmmessage'&amp=3Bgt=3D3B&amp=3Blt=3D3Bdi=
> >v dir=3D3D3D'ltr'&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D<br>=
> >&gt=3B &gt=3B=3D3Bnbsp=3D3D3B&amp=3Bamp=3D3Bnbsp=3D3D3BI have =3D3D&lt=3Bbr=
> >&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Ban IntSeq.T wi=3D<br>&gt=
> >=3B &gt=3Bth a bunch of integers.&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3B=
> >nbsp=3D3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D<br>&gt=3B &gt=3B=3D3Bbr&a=
> >mp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bspa=3D3D&lt=3Bbr&g=
> >t=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bn style=3D3D3D"f=3D<br>&gt=
> >=3B &gt=3Bont-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &=
> >amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D<br>&gt=3B &gt=3B=
> >=3D3B&amp=3Blt=3D3Bspan style=3D3D3D"font=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B =
> >&amp=3Bgt=3D3B&amp=3Bgt=3D3B-size: 12pt=3D3D3B "&amp=3Bg=3D<br>&gt=3B &gt=
> >=3Bt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3BWhat is=
> > a good terse efficient idiom f=3D<br>&gt=3B &gt=3Bor so=3D3D&lt=3Bbr&gt=3B=
> >&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Brt and unique?&amp=3Blt=3D3Bspan=
> > style=3D3D3D"font-siz=3D<br>&gt=3B &gt=3Be: 12pt=3D3D3B "&amp=3Bgt=3D3B&am=
> >p=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=
> >=3Bgt=3D3B&amp=3Blt=3D<br>&gt=3B &gt=3B=3D3B=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D=
> >3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&a=
> >mp=3Bgt=3D3B&amp=3Ba=3D<br>&gt=3B &gt=3Bmp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/sp=
> >an&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=
> >=3D3B&amp=3Blt=3D3Bbr&amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3Blt=3D3B/div&a=
> >mp=3Bgt=3D3B&amp=3Blt=3D3Bdiv=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D=
> >3B&amp=3Bgt=3D3B&amp=3Bgt=3D3B&amp=3Blt=3D3Bbr&amp=3Bgt=3D3B&amp=3B=3D<br>&=
> >gt=3B &gt=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3B=
> >amp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B In C++ I wo=3D<br>&gt=3B &gt=
> >=3Buld say:&amp=3Blt=3D3Bspan style=3D3D3D"font-si=3D3D&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bze: 12pt=3D3D3=3D<br>&gt=3B &gt=3BB =
> >"&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3B=
> >lt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=3D<br>&gt=3B &gt=3B=3D3D=
> >3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3B=3D3D&lt=3Bbr&gt=3B=
> >&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bnbsp=3D3D3=3D<br>&gt=3B &gt=3BB&=
> >amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=
> >=3D3Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=3D3D3D"font=3D<br>&gt=3B &gt=
> >=3B-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=
> >=3D3Bnbsp=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D<br>&g=
> >t=3B &gt=3B=3D3B=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan =
> >style=3D3D3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D3B=3D<br>&gt=3B &gt=3B&amp=
> >=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3Bvector&amp=3Bamp=3D3=
> >Blt=3D3D3Bin=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B=3D<br>&gt=3B &=
> >gt=3B&amp=3Bgt=3D3Bt&amp=3Bamp=3D3Bgt=3D3D3B a=3D3D3B&amp=3Blt=3D3Bspan sty=
> >le=3D3D3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3B=
> >amp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=
> >=3D3B&amp=3Blt=3D3Bsp=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B =3D<br>&gt=3B &gt=3B=
> >&amp=3Bgt=3D3B&amp=3Bgt=3D3Ban style=3D3D3D"font-size: 12pt=3D3D3B "&amp=3B=
> >gt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D<br>&gt=3B &gt=3B=3D3B/span&am=
> >p=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&=
> >amp=3Blt=3D3Bspan style=3D3D3D"f=3D3D&lt=3Bbr&gt=3B=3D<br>&gt=3B &gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bont-size: 12pt=3D3D3B "&amp=3Bgt=3D3=
> >B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D<br>&gt=3B &gt=3B=3D3D3B&=
> >amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=3D3D3D"font-size: =
> >12pt=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bg=3D<br>&gt=3B &gt=3Bt=3D3B&am=
> >p=3Bgt=3D3B=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/=
> >span&amp=3Bgt=3D3Ba.push_back(...)=3D3D=3D<br>&gt=3B &gt=3B3B&amp=3Blt=3D3B=
> >span style=3D3D3D"font-size: 12pt=3D3D3B "=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B=
> > &amp=3Bgt=3D3B&amp=3Bgt=3D3B&amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3Bamp=
> >=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3=
> >B&amp=3Blt=3D3Bspan style=3D3D3D"=3D<br>&gt=3B &gt=3Bfont-size: 12pt=3D3D3B=
> > "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span=3D3D&lt=3Bbr&=
> >gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B=3D<br>&gt=3B &gt=3B&amp=3Bgt=3D3B&amp=3B=
> >gt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=
> >=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=3D<br>&gt=3B &gt=3B=3D3=
> >D3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=
> >=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/s=3D<br>&gt=3B &gt=3Bpa=3D3D&lt=3Bbr&g=
> >t=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bn&amp=3Bgt=3D3B&amp=3Blt=3D3=
> >Bspan style=3D3D3D"font-size: 12pt=3D3D=3D<br>&gt=3B &gt=3B3B "&amp=3Bgt=3D=
> >3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3Ba.push_back(..=
> >.)=3D3D3B&amp=3Blt=3D3Bsp=3D3D=3D<br>&gt=3B &gt=3B&lt=3Bbr&gt=3B&amp=3Bgt=
> >=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Ban style=3D3D3D"font-size: 12pt=3D3D3B "&=
> >amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbs=3D<br>&gt=3B &gt=3Bp=3D3D3B &amp=3Bamp=3D3B=
> >nbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=3D3D3D=
> >"fon=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B &amp=3Bgt=3D3B&am=
> >p=3Bgt=3D3Bt-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&am=
> >p=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3B=3D<br>&gt=3B &gt=3Blt=3D3B/div&amp=3B=
> >gt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=3D3D3D"font-=
> >size: 12pt=3D3D&lt=3Bbr&gt=3B&amp=3B=3D<br>&gt=3B &gt=3Bgt=3D3B &amp=3Bgt=
> >=3D3B&amp=3Bgt=3D3B=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=
> >=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span=3D<br>&gt=3B &gt=3B&amp=3Bgt=3D3B=
> >&amp=3Blt=3D3Bspan style=3D3D3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=
> >=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D<br>&gt=3B &gt=3B=3D3B=3D3D&lt=3Bbr&gt=3B=
> >&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B/span&amp=3Bgt=3D3Bstd::sort(a.b=
> >egin()=3D3D2C a.end())=3D<br>&gt=3B &gt=3B=3D3D3B&amp=3Blt=3D3Bspan style=
> >=3D3D3D"font-size: 12pt=3D3D3B "=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=
> >=3D3B&amp=3Bgt=3D3B=3D<br>&gt=3B &gt=3B&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D=
> >3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=
> >=3D3Bspan style=3D3D=3D<br>&gt=3B &gt=3B3D"font-size: 12pt=3D3D3B "&amp=3Bg=
> >t=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span=3D3D&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3Bgt=3D3B&amp=3Bgt=3D3B&a=
> >mp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3B=
> >span style=3D3D3D"font-si=3D<br>&gt=3B &gt=3Bze: 12pt=3D3D3B "&amp=3Bgt=3D3=
> >B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&a=
> >mp=3Bgt=3D3B&amp=3Blt=3D<br>&gt=3B &gt=3B=3D3Bsp=3D3D&lt=3Bbr&gt=3B&amp=3Bg=
> >t=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Ban style=3D3D3D"font-size: 12pt=3D3D3B "=
> >&amp=3Bgt=3D3B&amp=3Ba=3D<br>&gt=3B &gt=3Bmp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/=
> >span&amp=3Bgt=3D3Ba.resize(std::unique(a.begi=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=
> >=3D3B &amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3Bgt=3D3Bn()=3D3D2C a.end()) -=
> > a.begin())=3D3D3B&amp=3Blt=3D3Bspan style=3D3D3D"font-size=3D<br>&gt=3B &g=
> >t=3B: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B=3D3D&lt=3Bbr&gt=
> >=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B &amp=3Bamp=3D3Bnbsp=3D<br>&g=
> >t=3B &gt=3B=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=
> >=3D3D3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bam=3D<br>&gt=3B &gt=3B=
> >p=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3B=
> >gt=3D3B&amp=3Blt=3D3Bd=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=
> >=3Bg=3D<br>&gt=3B &gt=3Bt=3D3Biv&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=3D3D=
> >3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D<br>&gt=3B &=
> >gt=3B=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B for (auto i =3D3D3D a.=3D3D&lt=3Bbr=
> >&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bbegin(=3D<br>&gt=3B &gt=3B=
> >)=3D3D3B i !=3D3D3D a.end()=3D3D3B ++i)&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&am=
> >p=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv=3D<br>&gt=3B &gt=3B&amp=3Bgt=
> >=3D3B&amp=3Blt=3D3Bspan style=3D3D3D"font-size=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=
> >=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B: 12pt=3D3D3B =3D<br>&gt=3B &gt=3B"&amp=
> >=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B {&amp=3Blt=
> >=3D3Bbr&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Ba=3D<br>&gt=3B &gt=
> >=3Bmp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B do stuff with=3D3D&lt=3Bbr=
> >&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B *i&amp=3B=3D<br>&gt=3B &g=
> >t=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3=
> >Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=3D3D3D"font-s=3D<br>&gt=3B &gt=
> >=3Bize: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D=
> >3Bnbsp=3D3D3B =3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D<br>&gt=3B &gt=
> >=3B=3D3B&amp=3Bgt=3D3B}&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&=
> >amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=
> >=3B=3D<br>&gt=3B &gt=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=
> >=3D3B&amp=3Blt=3D3Bbr&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Bl=
> >t=3D3Bdiv&amp=3Bgt=3D3B=3D<br>&gt=3B &gt=3B&amp=3Blt=3D3Bspan style=3D3D3D"=
> >font-si=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bze: 12=
> >pt=3D3D3B "&amp=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &am=
> >p=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan =
> >style=3D3D3D"=3D<br>&gt=3B &gt=3Bfont-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=
> >=3Bamp=3D3B=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bnb=
> >sp=3D3D3B&amp=3Blt=3D<br>&gt=3B &gt=3B=3D3B/span&amp=3Bgt=3D3BNice=3D3D2C t=
> >erse=3D3D2C efficient.&amp=3Blt=3D3Bspan style=3D3D3D"font-siz=3D<br>&gt=3B=
> > &gt=3Be: 12pt=3D3D3B =3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=
> >=3Bgt=3D3B"&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D<=
> >br>&gt=3B &gt=3B=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan =
> >style=3D3D3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bam=3D<br>&gt=3B &=
> >gt=3Bp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/spa=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &=
> >amp=3Bgt=3D3B&amp=3Bgt=3D3Bn&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&=
> >amp=3Blt=3D<br>&gt=3B &gt=3B=3D3Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan style=
> >=3D3D3D"font-size: 12pt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D<br>&gt=
> >=3B &gt=3B=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D=
> >3B&amp=3Blt=3D3Bs=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=
> >=3D3Bpan=3D<br>&gt=3B &gt=3B style=3D3D3D"font-size: 12pt=3D3D3B "&amp=3Bgt=
> >=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3BIn=3D<br>&g=
> >t=3B &gt=3B Modula-3?&amp=3Blt=3D3Bspan style=3D3D3D=3D3D&lt=3Bbr&gt=3B&amp=
> >=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B"font-size: 12pt=3D<br>&gt=3B &gt=3B=
> >=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B &amp=3Bamp=3D3Bnbsp=3D3D3=
> >B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3Bspan s=3D<br>&gt=3B &gt=3Bt=
> >yle=3D3D3D"font-size: 12p=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&a=
> >mp=3Bgt=3D3Bt=3D3D3B "&amp=3Bgt=3D3B&amp=3Bamp=3D3Bnbsp=3D<br>&gt=3B &gt=3B=
> >=3D3D3B&amp=3Blt=3D3B/span&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&am=
> >p=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bbr&amp=3Bgt=3D3B&amp=3Blt=3D3B/d=
> >=3D<br>&gt=3B &gt=3Biv&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3Bl=
> >t=3D3Bbr&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=
> >=3Bgt=3D3BI know =3D<br>&gt=3B &gt=3Bthat =3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B=
> > &amp=3Bgt=3D3B&amp=3Bgt=3D3Bunique is one of the easiest algorithms to m=
> >=3D<br>&gt=3B &gt=3Banually write inline=3D3D2C&amp=3Blt=3D3B/div&amp=3Bgt=
> >=3D3B&amp=3Blt=3D3Bd=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3B=
> >gt=3D3Bi=3D<br>&gt=3B &gt=3Bv&amp=3Bgt=3D3Bbut I shouldn't have to.&amp=3Bl=
> >t=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bbr&amp=
> >=3Bgt=3D<br>&gt=3B &gt=3B=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3=
> >Bdiv&amp=3Bgt=3D3B&amp=3Blt=3D3Bbr&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=
> >=3D3B&amp=3Blt=3D3Bdiv&amp=3Bg=3D<br>&gt=3B &gt=3Bt=3D3B(I'm re=3D3D&lt=3Bb=
> >r&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3Bally trying to stay in Mo=
> >dula-3 here=3D<br>&gt=3B &gt=3B=3D3D2C but it is definitely a struggle. :(=
> >=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B )&amp=3Blt=
> >=3D3B=3D<br>&gt=3B &gt=3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3B&=
> >amp=3Blt=3D3Bbr&amp=3Bgt=3D3B&amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3B=
> >div&amp=3Bgt=3D3B&amp=3Blt=3D<br>&gt=3B &gt=3B=3D3Bbr&amp=3Bgt=3D3B&amp=3Bl=
> >t=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D3Bdiv&amp=3Bgt=3D3BThank you=3D3D2C&amp=
> >=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D<br>&gt=3B &gt=3B=3D3Bdiv&amp=3Bgt=
> >=3D3B&amp=3Bamp=3D3Bnbsp=3D3D3B-=3D3D&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3Bgt=
> >=3D3B&amp=3Bgt=3D3B Jay&amp=3Blt=3D3B/div&amp=3Bgt=3D3B=3D<br>&gt=3B &gt=3B=
> >&amp=3Blt=3D3Bbr&amp=3Bgt=3D3B&amp=3Blt=3D3Bbr&amp=3Bgt=3D3B&amp=3Blt=3D3B/=
> >div&amp=3Bgt=3D3B &amp=3Blt=3D3B/div&amp=3Bgt=3D3B&amp=3Blt=3D<b=
> >r>&gt=3B &gt=3B=3D3B/body&amp=3Bgt=3D3B&lt=3Bbr&gt=3B&amp=3Bgt=3D3B &amp=3B=
> >gt=3D3B&amp=3Bgt=3D3B&amp=3Blt=3D3B/html&amp=3Bgt=3D3B=3D3D&lt=3Bbr&gt=3B&a=
> >mp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3B=3D<br>&gt=3B &gt=3Bgt=3D3B&lt=3Bbr&gt=3B=
> >&amp=3Bgt=3D3B &amp=3Bgt=3D3B&amp=3Bgt=3D3B--_d2a02ece-d492-410e-88fb-fb537=
> >37d7219_--&lt=3Bbr&gt=3B&lt=3B=3D<br>&gt=3B &gt=3B/div&gt=3B&lt=3B/div&gt=
> >=3B &lt=3B/div&gt=3B&lt=3B/body&gt=3B<br>&gt=3B &gt=3B&lt=3B/htm=
> >l&gt=3B=3D<br>&gt=3B &gt=3B<br>&gt=3B &gt=3B--_7877d7e8-cb4a-4989-bdcd-d406=
> >e5b1f51f_--<br></div></div></div> </div></body>
> ></html>=
> >
> >--_13e6ee6a-034c-469d-aa83-18379d050866_--
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120930/f4b05b49/attachment-0002.html>


More information about the M3devel mailing list