On Thu, Mar 18, 2010 at 4:17 PM, David Ward Lambert
<[email protected]> wrote:
> When I run my dog I count critters.  I can identify some of them.  And
> so developed a taxonomy counter  in python.  Incrementing one of these
> objects also  increments all those above  it.  Thus if we  find a frog
> I'd increment the animal object;  on finding a skunk we'd go elsewhere
> before incrementing "mammal".  Home again I'd read 2 animal, 1 mammal,
> 0 all else.   I suppose I used a registration  technique in the python
> object initializer.  Solutions in j please?

Like Bjorn suggests, the OOP lab sounds like what
you are looking for (it is in the "Language" group of
labs).

That said, incrementing things repeatedly in J is usually
the wrong approach.  Incrementing things repeatedly in J
is sort of like using your car to transport objects on to the
roof of your house by adding and removing air from the
shocks so you can implement a ratchet device.

It can certainly be made to work, but if there is an actual
problem you are trying to solve, there might be better
approaches?

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

Reply via email to