[Jprogramming] Question about the "Each" Adverb

Leigh J. Halliwell leigh at lhalliwell.com
Thu Aug 31 04:12:47 HKT 2006


Dear J Forum:
 
My subroutine 'x SAMPLE y' simulates x values from a discrete distribution
y, where y is a two-column matrix whose first column contains the values and
whose second column contains the probabilities.  If I have two distribution
matrices y1 and y2, '100 SAMPLE each (y1;y2)' will box 100 samples from each
distribution.  And '(50;100) SAMPLE each (y1;y2)' will box 50 samples from
y1 and 100 samples from y2.  But the call '(50;100) SAMPLE y1' will not
work, no matter where I place the adverb.  I get the message 'length error'.
 
Yes, I can do '150 SAMPLE y1' and then box 50 and 100.  But is there a way
of making "each" work on the left argument as well as it works on the right?
 
Sincerely,
 
Leigh


More information about the Programming mailing list