June Kim wrote:
> Suppose there is a class called "Stack" and it includes "pop" method.
> 
> Now I create three stack instaces, each named s1, s2, and s3. What I
> want to do is call "pop" on each of them and gather the results into
> one vector.

I've been wishing for a built-in way to do that.  Maybe later.

For now, you can use a conjunction (which takes a method name as a 
left argument and an object list as a right argument) which produces 
the desired verb.

eachObj=:2 :0
 ((<m),each '_',each n,each '_')`:0
)

Thus, if stacks is a list of stack objects all of which have
the pop method:
  'pop' eachObj stacks ''

-- 
Raul

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

Reply via email to