On 02-01-12 11:21, Linda Alvord wrote:
> This was a while ago, but how about a simple J version:
>
> brila=: 13 :'([:(++:)/|.)"1 y'
> brila
> ([: (+ +:)/ |.)"1
> n=:5 3$ 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0
> n
> 0 0 0
> 0 0 1
> 0 1 0
> 0 1 1
> 1 0 0
> brila n
> 0 1 2 3 4
>
> I'm still puzzled by how it works:
#. 1 0 1 0 1 0 1
85
13 :'x + 2*y'/ |. 1 0 1 0 1 0 1
85
or
13 :'x + +: y'/ |. 1 0 1 0 1 0 1
85
Simple J(?)
13 :'x + +: y'
[ + [: +: ]
or concise:
(++:)
Base 10 example:
13 :'x + 10*y'/ |. 1 2 3 4 5
12345
(+10&*)/ |. 1 2 3 4 5
12345
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm