Here is the beginning of a slightly different
approach based on inverted tables. I will try to complete it
soon.
p=:4 3$;:'p0 p0 p0 p1 p1 p1 p0 p1 p0 p1 p0 p0'
s=: ;:'s0 s1 s2 s3'
t=: ;:'t0 t1 t2'
$tab=:,/(<"0 p),&>"0~ s<@,"0/ t
12 3
$'S T P'=: |:tab
3 12
$x=:S;T;P NB. an inverted table according to Roger
3
tindexof =: i.&>[EMAIL PROTECTED] i.&|: i.&>
tkey=: 1 : '<@[EMAIL PROTECTED] u/.&.> ]'
>(1 2{x) < tkey 0 {x
+--+--+--+--+--+--+
|s0|s0|s0|s1|s1|s1|
|s2|s3|s2|s3|s2| |
| | |s3| | | |
+--+--+--+--+--+--+
>(0 2{x) < tkey 1 {x
+--+--+--+--+--+--+
|t0|t0|t0|t1|t0|t1|
|t1|t1|t2| | |t2|
|t2|t2| | | | |
+--+--+--+--+--+--+
(B=) <----------my "sig"
Brian Schott
Atlanta, GA, USA
schott DOT bee are eye eh en AT gee em ae eye el DOT com
http://schott.selfip.net/~brian/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm