If you just have (spiral) pattern e3 and f:

e3=. 5 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
f=. 1 2 3 5 8 13 21

then you may use:

   ]P=. e3 (1j1 #"1 $@[ $ (('X','@'$~<:@#@[)`(i.~)`(('.'$~#)@])},)~) f
@ . . . .
. @ . @ .
. @ X . .
. . @ . .
. . . . @

getting a pretty picture. Note that

   $ P
5 10

indicating a trailing space.



On 04-12-12 11:01, Ric Sherlock wrote:
Given that there appears to be a minor error in the definition of e3 in the
original post, I'll repeat what I think was intended below:

    e3=: 12 13 14 15 16 11 2 3 4 17 10 1 0 5 18 9 8 7 20 6 19 24 23 22 21
    f=: 1 2 3 5 8 13 21
    e3=: 5 5$ e3
    ;"1 (e3 e."1 f)} (5 5$<'. '),:<'@ '
NB. or the more complete ...
    1j1&#"1 ((e3 e."1 {.f)+e3 e."1 f)}'.','@',:5 5$'X'


On Tue, Dec 4, 2012 at 10:17 PM, Ric Sherlock <[email protected]> wrote:

the original e3 is also defined in the original post.
The line ( e3=: 5 5 $ e3 ) in my post is just reshaping the original e3 as
a table rather than a list.





On Tue, Dec 4, 2012 at 10:11 PM, Linda Alvord <[email protected]>wrote:

Ric,

     e3=: 5 5$ e3
    f=.1 2 3 5 8 13 21
    (e3 e."1 f)} (5 5$<'. '),:<'@ '
|stack error: e3
|   (    e3 e."1 f)}(5 5$<'. '),:<'@ '
    ;"1 (e3 e."1 f)} (5 5$<'. '),:<'@ '

When does ;"1  apply if there is already a "stack error" without?

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ric
Sherlock
Sent: Tuesday, December 04, 2012 3:46 AM
To: Programming JForum
Subject: Re: [Jprogramming] Getting more than one value back from "From"
or
alternative approach

Linda, you'll find f explained and defined in the original post. It is the
Fibonacci series.



On Tue, Dec 4, 2012 at 9:32 PM, Linda Alvord <[email protected]
wrote:
Now for this thread.....

Do you pull  f  out of some strange "hat" somewhere?

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ric
Sherlock
Sent: Monday, December 03, 2012 10:17 PM
To: Programming JForum
Subject: Re: [Jprogramming] Getting more than one value back from
"From" or alternative approach

Does this provide something similar to what you are wanting?

    e3=: 5 5$ e3
    ;"1 (e3 e."1 f)} (5 5$<'. '),:<'@ '
. @ . . .
. @ @ . .
. @ . @ .
. @ . . .
. . . . @



On Tue, Dec 4, 2012 at 3:21 PM, PackRat <[email protected]> wrote:

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

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

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

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

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


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

--
Met vriendelijke groet,
@@i = Arie Groeneveld

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

Reply via email to