[Jprogramming] removing duplicate f from "f@g u f@h"

Miller, Raul D rdmiller at usatoday.com
Wed Feb 8 06:34:32 HKT 2006


June Kim wrote:
> So in order to generalize the transformation, I have to 
> something like:
>    gr=: {. g b. 0
>    hr=: {. h b. 0
>    (g u&f"(gr,hr) h)

That looks about right.

But I think that either
   (g u&:f"(gr,hr) h)
or
   (g u&(f"(gr,hr)) h)
would be a closer fit.  This is because
the effective rank between the components of 
a fork is infinite.  (The rank of the tines
is not imposed on the fork as a whole.)

And, as you've already noted, in many cases
this sort of thing is unnecessary.

And, of course, the above expressions are for the 
monadic case, not the dyadic case.

On the other hand, if you're thinking about automated
rewrite rules, you're possibly heading down the
wrong path.

It's good to think about automated rewrite rules
if you want to understand the language.  It would
also be good to have that kind of understanding 
if you wanted to implement the language.

However, in the typical case that kind of generality
is a distraction.  The language is rich in simularities,
but it's better to think about what your context 
(application, problem space, examples, whatever)
than it is to think about all the random equivalences 
that you might be able to support.

I don't know if I'm very convincing here, but 
being overly general in some random direction 
often means you've lost track of the problem
you were originally trying to work with.

-- 
Raul



More information about the Programming mailing list