Arved Sandstrom wrote:

> Just out of curiosity, without asking for a solution, would experts here
> consider both discrete convolution and 2-D Bresenham's algorithm to be 1-3
> line J programs?
>

Convolution is certainly a 1-liner.  For 1D convolution, the simplest
thing to use is
   pp=:+//.@(*/) NB. polynomial product
   1 1 pp 1 1
1 2 1

More elaborately, look at infix (dyadic \) and cut (dyadic ;.0).

I imagine Bresenham's algorithm can be put in one line with some care over
cases.  The key step is accumulating sums, which you can do with +/\ .

Best wishes,

John



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

Reply via email to