Hi, I'm not quite sure what you mean by "reducing explicit ranks" - could you elaborate?
Cheers, Mike On Mon, Jun 17, 2013 at 1:25 AM, Aai <[email protected]> wrote: > Same results can be obtained by reducing explicit ranks. > > (2 2$0 1 100 0) ([;];* ;*"1 2; *"1;*"1 1"1 2) 1+i.2 2 2 > ┌─────┬───┬───────┬───────┬───**──┬─────┐ > │ 0 1│1 2│ 0 0│ 0 0│ 0 2│ 0 2│ > │100 0│3 4│ 3 4│ 3 4│ 0 4│ 0 4│ > │ │ │ │ │ │ │ > │ │5 6│500 600│500 600│500 0│500 0│ > │ │7 8│ 0 0│ 0 0│700 0│700 0│ > └─────┴───┴───────┴───────┴───**──┴─────┘ > > > > On 16-06-13 20:59, Michal D. wrote: > >> Hi All, >> >> Here's an interesting behaviour I came across while trying to implement a >> J >> interpreter - the behaviour of nested ranks. It turns out that using " >> actually does not modify the rank of the underlying verb but adds another >> wrapper in how it is applied. >> >> Note that (1) and (2) below produce different results. >> >> box2 provides an easier way to visualize what arguments a verb is applied >> to. >> >> Mike >> >> --- >> >> ] y=:2 2 $ 0 1 100 0 >> 0 1 >> 100 0 >> ] z =: 2 2 2 $ 1+i. 100 >> 1 2 >> 3 4 >> >> 5 6 >> 7 8 >> y *"1 2 z NB. (1) >> 0 0 >> 3 4 >> >> 500 600 >> 0 0 >> y (*"1 1)"1 2 z NB. (2) >> 0 2 >> 0 4 >> >> 500 0 >> 700 0 >> box2=: (<@:[),(<@:]) >> y box2"1 2 z >> +-----+---+ >> |0 1 |1 2| >> | |3 4| >> +-----+---+ >> |100 0|5 6| >> | |7 8| >> +-----+---+ >> y (box2"1 1)"1 2 z >> +-----+---+ >> |0 1 |1 2| >> +-----+---+ >> |0 1 |3 4| >> +-----+---+ >> >> +-----+---+ >> |100 0|5 6| >> +-----+---+ >> |100 0|7 8| >> +-----+---+ >> ------------------------------**------------------------------** >> ---------- >> For information about J forums >> seehttp://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm> >> > > -- > Met vriendelijke groet, > @@i = Arie Groeneveld > > ------------------------------**------------------------------**---------- > For information about J forums see > http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm> ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
