I thought I had written about it, but could not find it in
J Forums, neither on my websites. It turns out it is
dated circa Jun 1998 and resides on comp.lang.apl.
    artificial polymorphism model as of J 401
    http://groups.google.com/group/comp.lang.apl/msg/9a5709a6ba91433d

Note: the last loop can be encapsulated in a convenience
conjunction.

Also related is the topic of "Distributed Apply"
    http://www.jsoftware.com/jwiki/Essays/Distributed%20Apply
   



----- Original Message ----
> From: Matthew Brand <[email protected]>
> 
> If I have a simple class such as:
> coclass 'example'
> 
> create =: 3 : ' X =: y'
> destroy =: codestroy
> 
> And I make a list of new objects:
> n =.'example' (conew~)"(1 0) i.4
> 
>    n
> +-+-+-+-+
> |4|5|6|7|
> +-+-+-+-+
> 
> Then I can get at the X's inside each object like this:
>    X_4_
> 0
>    X_5_
> 1
> 
> And like this:
> v =. <":5
> X__v
> 1
> 
> But how can I reconstruct the values of the X's from the list n?
> 
> i.e., is there anything that looks like this?
>     (X__ )"0 n
> 0 1 2 3
> 
> Presumably the code to call a method on each object would look the same?
> 
> I.e if there was a method: getX =: 3 : 'X'
> 
> then calling it would look like?
> (getx__ )"0 n


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

Reply via email to