[Jprogramming] tactic programming
Mike Day
mike_liz.day at tiscali.co.uk
Thu Jun 7 14:54:02 HKT 2007
Dear J Language
Raul's is what you want if you're happy with
an explicit answer. However, if by "tactic"
you mean "tacit" then this might be what you
want.
NB. Given
open =: 100 101 103 104 103 102
close =: 101 100 104 104 105 103
NB. make a 2-row matrix using ,: "laminate"
open (,:)close
100 101 103 104 103 102
101 100 104 104 105 103
NB. study use of u/. "oblique" ...
open (%//.@:,:)close
100 1 1.03 1 0.990385 0.971429 103
NB. clean up ends if you need to ...
open (}.@}:@(%//.@:,:))close
1 1.03 1 0.990385 0.971429
NB. If the quotes are columns in a table,
NB. eg (for your example) ...
tab=:(open,.close)1 4}"1(100+?6 5$ 6)
NB. you can do this sort of thing...
(}.@}:@(%//.)@:|:)1 4 {"1 tab
1 1.03 1 0.990385 0.971429
Mike
Raul Miller wrote:
> On 6/7/07, j.language at antelecom.net <j.language at antelecom.net> wrote:
>> Given:
>> open =: 100 101 103 104 103 102
>> close =: 101 100 104 104 105 103
>> how about
>> +/ open(index+1) % close(index)
>
> Perhaps you mean
> +/ (}.open) % }:close
> ?
>
> If not, could you specify more precisely what it is that
> you mean?
>
> Thanks,
>
More information about the Programming
mailing list