Yeah, I picked that up off of Raul in a codeGolf thing we did last summer.
I like your way of generating the matrix but it doesn't have the 'X' for the 0 in Harvey's original example. I just relied on sqdata being defined so I am really not being critical :) Cheers, bob On 2012-12-03, at 9:38 PM, Ric Sherlock wrote: > Thanks Bob, I was trying to work out how to insert alternate spaces and > 1j1# is nicer than my solution. Here is a simplification of my earlier > idea: > 1j1&#"1 (e3 e."1 f)} (5 5$'.'),:'@' > . @ . . . > . @ @ . . > . @ . @ . > . @ . . . > . . . . @ > > > > > > On Tue, Dec 4, 2012 at 6:13 PM, bob therriault <[email protected]>wrote: > >> Harvey, >> >> Is there a reason that you would not be able to add the spaces at the end >> using iji # ? >> >> 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 >> 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@@.@..@....@.......@….' NB. Spaces removed from character >> string >> e=.5 5 $ e3 { sqdata >> e >> @.... >> .@.@. >> .@X.. >> ..@.. >> ....@ >> 1j1#"1 e >> @ . . . . >> . @ . @ . >> . @ X . . >> . . @ . . >> . . . . @ >> >> Cheers, bob >> >> On 2012-12-03, at 6:21 PM, PackRat 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
