[Jprogramming] tactic programming
Mike Day
mike_liz.day at tiscali.co.uk
Thu Jun 7 22:49:13 HKT 2007
Randy
Yes - though I do like the use of oblique on a table
here. Not so useful for offsets or lags other than
one time interval.
Mike
R.A. MacDonald wrote:
> Hello Mike;
>
> Does this work?
>
> open (([: }. [)(+/ . %)([: }: ])) close
>
> Mike Day wrote:
>> Sorry, I forgot to add the add:
>>
>> open (+/@}.@}:@(%//.@:,:))close
>>
>> 4.99181
>>
>> (+/@}.@}:@(%//.)@:|:)1 4 {"1 tab
>>
>> 4.99181
>>
>> Mike
>>
>> Mike Day wrote:
>>> [re-sent for readability - Thunderbird had removed
>>> some line throws. There'll be some extra line padding
>>> now - I think!]
>>>
>>> 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,
>>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
More information about the Programming
mailing list