It is not quite clear what you are looking for when saying ">:".
In linear analogy, ">:" has the property of being invariant under shift: a >: b <=> (a+c) >: (b+c) for any c whereas for circular degrees 135 >: 45 but (270+135) ? (270+45) ~ so which is it 405 ? 315 ~ 45 ? 315 ~ 45 ? -45 Thus still no match (>:/;(>:/&(360&|))&dfd)~45*i. 17 +---------------------------------+---------------------------------+ |1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1| |1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1| |1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0|1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1| |1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0|1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1| |1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0|1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1| |1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0|1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1| |1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0|1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1| |1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0|1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1| |1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0|1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1| |1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0|1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1| |1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0|1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1| |1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0|1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1| |1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0|1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1| |1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0|1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1| |1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0|1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1| |1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0|1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1| |1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1|1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1| +---------------------------------+---------------------------------+ A shift invariant comparison would be to determine whether one angle is clock-wise to another. Using phrases/phrc7.ijs, rfd=: %&180p_1 vec2=: +...@r.@rfd cw=: (0 >: *)@cross1&vec2"0 ~. (cw/ ; cw/&(135&+) ; cw/&(13&+) ; cw/&dfd)~45*i. 17 +---------------------------------+ |1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1| |1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1| |1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1| |1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1| |1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1| |0 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0| |0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0| |0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 0| |1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1| |1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1| |1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1| |1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1| |1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1| |0 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0| |0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0| |0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 0| |1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1| +---------------------------------+ -:"0/~ (cw/ ; cw/&(135&+) ; cw/&(13&+) ; cw/&dfd)~45*i. 17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > From: Brian Schott <[email protected]> > > In the turtle graphics system I am developing, I > force the angular headings of objects expressed in degrees > to the range (_180,180] with the verb dfd shown below. So > for example dfd produces the following results for an object > with a starting heading of 0 degrees and turning 45 degrees > to the right at each step until it completes a 360 turn. > > dfd=: 360&|&.(180&-) > (,: dfd)45*i. 9 > 0 45 90 135 180 225 270 315 360 > 0 45 90 135 180 _135 _90 _45 0 > > The following two boxes show the behavior of a >: > comparison table for angles between 0 and 360 degrees > without and with the dfd translation. I think I understand > how I could programatically stop a turning object at a > desired heading in the table of raw angle comparisons (using > the simple >: primitive), but not how to do so for the > righthand table of dfd'd angle comparisons. How can I do the > latter? I suppose I am asking what is the inverse of dfd. > > (>:/;>:/&dfd)~45*i. 9 > +-----------------+-----------------+ > |1 0 0 0 0 0 0 0 0|1 0 0 0 0 1 1 1 1| > |1 1 0 0 0 0 0 0 0|1 1 0 0 0 1 1 1 1| > |1 1 1 0 0 0 0 0 0|1 1 1 0 0 1 1 1 1| > |1 1 1 1 0 0 0 0 0|1 1 1 1 0 1 1 1 1| > |1 1 1 1 1 0 0 0 0|1 1 1 1 1 1 1 1 1| > |1 1 1 1 1 1 0 0 0|0 0 0 0 0 1 0 0 0| > |1 1 1 1 1 1 1 0 0|0 0 0 0 0 1 1 0 0| > |1 1 1 1 1 1 1 1 0|0 0 0 0 0 1 1 1 0| > |1 1 1 1 1 1 1 1 1|1 0 0 0 0 1 1 1 1| > +-----------------+-----------------+ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
