Answer to Q1
a2 =: ] (] , ] + _1 + 3*2^2-~[) ([:i.1+2^2-~])

Answer to Q2
It's recalculated.  See the following.

   echo=: 1!:2&2
   f=: *:@echo , 3 * *:@echo
   f 5
5
5
25 75



----- Original Message -----
From: Arie Groeneveld <[EMAIL PROTECTED]>
Date: Friday, November 2, 2007 9:28
Subject: [Jprogramming] xpliicit v tacit
To: Programming forum <[email protected]>

> Dear xperts J-ers,
> 
> Here are two versions for aiken code generation
> based on the same algorithm.
> 
> +-------+-------+
> |bin    |aiken  |
> +-------+-------+
> |0 0 0 0|0 0 0 0|
> |0 0 0 1|0 0 0 1|
> |0 0 1 0|0 0 1 0|
> |0 0 1 1|0 0 1 1|
> |0 1 0 0|0 1 0 0|
> |0 1 0 1|1 0 1 1|
> |0 1 1 0|1 1 0 0|
> |0 1 1 1|1 1 0 1|
> |1 0 0 0|1 1 1 0|
> |1 0 0 1|1 1 1 1|
> +-------+-------+
> 
> 
> I.
> aikenDX1=:3 :'(,(<:3*2^y-2)+])i.1+2^y-2'
>                               ---------
>                                  A
> 
> II.
> aikenD=:([:i.1+2^2-~]),([:<:3*2^2-~])+[:i.1+2^2-~]
>          -------------
>                 ------------
>              A                             B
> 
>    (aikenDX1 -: aikenD) 21
> 1
> 
> Observation shows that verb I is a bit faster.
> 
> Q1: Is it possible to make version I tacit not
>     in the way of verb II?
> (I expect not: y has to be known on two levels
>  of tacit as I may put it that way, but ...?)
> 
> Q2: In verb II parts A and B are the same.
>     Will A be a copy of B (optimization)
>     or is it calculated/generated again?
> 
> Q3: other approaches for a solution
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to