Yes, Ric!
Your verb seems to work nicely for me. I guess I am
surprised, but satisfied for my needs, that the rational
numbers must be in "reduced" form (eg, 8r10 must be applied
as 4 5, which J does with 2&x: ).
I don't think your constraint is expressed quite
right because these work.
bm 2 5
1 0 1 0 1
bm 3 7
1 0 1 0 1 0 1
But bm 1 5 and bm 2 7 do not work. So we'll have to
work on expressing the constraint.
Thanx,
(B=)
On Mon, 4 Feb 2008, Sherlock, Ric wrote:
+ ---Sherlock, Ric wrote:
+ >
+ > I'm sure there will be more elegant and tacit solutions, but in the
+ > meantime this explicit verb seems to do the job.
+ >
+ > bm=: 3 : 0
+ > 'n d'=. y
+ > t=. >.n % >:d-n
+ > d$(>:t) {. t#1
+ > )
+ >
+ > bm 4 5
+ > 1 1 0 1 1
+ > bm 7 10
+ > 1 1 0 1 1 0 1 1 0 1
+ >
+
+ but only for rational numbers >: 1r2 !!!
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm