> > Greg Troxel said: > > We are really re-inventing the traditional HP RPN, and > > that's ok, but it's better to re-implement it as > > consistently as possible. > > Actually Chuck Moore implemented Forth already in 1968, > four years before HP-35, the first HP RPN calculator, > was introduced. So in that sense "swap" is historically > more consistent than the 1984 PostScript "exch". > > My trusty old HP-15, now doing attic service, had a "x<>y" > key for "swap", and I see on the Wikipedia photo [1], > that that "x<>y" was used all the way back to the 1972 HP-35. > > The HP-48G, introduced in 1990, according to the photo [2] > had a key labelled "swap", so HP RPN appears to be more > true to Forth, than to PostScript. > > So for HP, as well as Forth, consistency, "swap" would be > preferable. > > The bad thing, however, is that PROJ stacks do not work as > one would immediately expect: Actually, there are 4 separate > stacks, one for each coordinate, so doing a "push v_1 v_2" > followed by a "pop v_2 v_1" does not do any swapping (sse the > example in footnote [4], and try to play with different orders > of v_1 and v_2). > > Hence, you need to do a preparatory axisswap step to actually > put the first coordinate onto the second coordinate stack (from > where it can be pop'd back into the first coordinate of the > operand). I tend to forget this... > > Rust Geodesy [4] makes do with one stack, but for semi-consistency > with PROJ, always pushes and pops in fixed order, i.e. pop v_2 v_1 > gives the same result as pop v_1 v_2 > > In order to follow the principle of least astonishment (POLA) [5], > I would have preferred a single stack, and push/pop in consistent > order. But since the state of things are as they are, keeping POLA > will probably require us to keep things as is. > > > [1] https://en.wikipedia.org/wiki/HP-35#/media/File:HP-35_Red_Dot.jpg > [2] https://upload.wikimedia.org/wikipedia/commons/9/95/HP48G.jpg > [3] echo 1 2 3 4 | cct proj=pipeline step proj=push v_1 v_2 step proj=pop > v_2 step proj=pop v_1 -- > [4] https://github.com/busstoptaktik/geodesy > [5] https://en.wikipedia.org/wiki/Principle_of_least_astonishment >
_______________________________________________ PROJ mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/proj
