Original-Via: uk.ac.st-and.cs; Wed, 27 Nov 91 11:41:37 GMT


Mark Jones sent me a message which included this:


-- PS. While I'm writing to you, can I ask about your other examples for
-- using c*n+k patterns?  I like the examples you gave, but can't think of
-- too many other applications.  If you have a spare moment some time (i.e.
-- no rush) I'd be interested to take a look at other applications.
-- Thanks!


Your request for more examples of uses of c*n+k patterns set me thinking.
At first I thought there would be lots and, being a fan of the Mandelbrot set,
I immediately thought about the Mariani-Silver algorithm which 'colours' a
rectangular region assuming it will be all the same colour if it's all the
same colour round the edge (I've yet to see this proved reasonable for regions
of the M-set, but it looks plausible). If the rectangle's edges contain
different colours then the algorithm splits the rectangle along its longer
edge and applies itself recursively to the sub-rectangles.

This, on the face of it, seems to require the kind of splitting that c*n+k
patterns would give. But on further investigation, it seems that something
new is needed. The kind of definition wanted is

f low up@(2*mid-low) =   ... f low mid ... f mid up ...

and this needs a c*n+k where the k is not a literal constant. In fact why
should either c or k have any constraints? The syntactic restriction for k to
be a +ve integer literal shouldn't be there --- any expression should be
allowed for c and k (and note how low is in scope in the second pattern
of the definition of f above). The semantic restriction of demanding that
n >= k for an n+k pattern to match just makes for the kind of mess that Brian
Boutel pointed out. And why integers only. Any numerical analyst will tell
you that range splitting of the kind given above is quite common with Floats.

Personally, I think n+k patterns are a baroque left-over from views that
someone thought would be nice to retain when views were abandonned. They
should either be thrown out or generalised in a more regular way.

Tony Davie

Reply via email to