I have an application where I have a numeric evolute that I want to 
visualize.  Essentially, I have a list of values within the evolute 
that I want to display as a given literal character, while the 
remaining values would be a default "background" literal character.

Everything works fine until I get to a point where I need to select 
values in such a way that I retrieve not only the "anchor" (selected) 
value from a list of ordered display characters but also one or more 
(depending on how the ordered list is constructed) succeeding 
separating characters.  "From" seems to be the kind of thing I'd like 
to do, but that returns only a single value for each element of the 
lefthand argument.  In other words, I know that you can do something 
like:

        0 4 10 18 { array

which will return FOUR elements from "array".  However, since in my 
case, each of the elements in "array" is followed (separated) by a 
space character, what I *want* returned are four PAIRS of characters 
(the element and its succeeding space): 0-1, 4-5, 10-11, and 18-19.

Is there some way to make "From" be able to do this, or can someone 
suggest another approach?  I'm stuck at the moment.  Here's a sample 
evolute of size 5:

   13 14 15 16 17
   12  3  4  5 18
   11  2  1  6 19
   10  9  8  7 20
   25 24 23 22 21

For this example's sake, I decided to "mark" the Fibonacci series 
(contained in a list):

   f=. 1 2 3 5 8 13 21

After the earlier half of the program does its thing (correctly), the 
next lines would be (e3 has 25 values):

   e3=. 12 13 14 15 16 11 2 3 4 17 10 1 0 5 18 9 8 7 6 19 24 23 22 21 
20

   sqdata=. 'X @ @ . @ . . @ . . . . @ . . . . . . . @ . . . . '

   e4=. (2 * e3) { sqdata    NB. this is the problem area

   e=. (2*5 , 5) $ e4

The end result (e) should look like this:

   @ . . . . 
   . @ . @ . 
   . @ X . . 
   . . @ . . 
   . . . . @ 

The reason I need the spacing characters is because a square doesn't 
look square on a screen or printer since characters are rectangular in 
shape (not square).  Looking square is important for my application.

Thanks in advance for any help solving this!


Harvey

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to