(personal response sent off list)

On Fri, Aug 9, 2013 at 5:18 PM, Devon McCormick <[email protected]> wrote:
> The basic code I stole from Cliff are these two things:
>
> NB.* pwlin: piecewise linear function
> pwlin=: 4 : 0"_ 0
>    'p c'=. x
>    i=. i.&0 p<y
>    ((1-r),r=.(y-~i{p)%-/(i-0 1){p)+/ .* (i- 0 1){c
> )
>
> hue=: <.@(0.5&+)@(((6%~i.7);255*|."1#:7|3^i.7)&pwlin)"0
> NB.EG hue 10%~i.10

That looks more general than I was comfortable using.

Generality can be a problem when it obscures the purpose of the code.
So I (perhaps arbitrarily) avoid it when it "feels wrong to me". Of
course, perhaps ironically, that's probably not an explanation which
would be generally useful to other people.

Here's a rule of thumb though: if making the code general more than
doubles the code length? It's high time to think about if it really
solves anything for you.

Thanks,

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

Reply via email to