Great! I overlooked the definition of Insert with gerunds.
No further need for the "toggle" verb!

Thank you,

Markus

Am 15.09.2010 16:28, schrieb Mike Day:
>    In order to solve your bank example, it is merely sufficient to do
>
>      *`+/ 1.03 300 1.025 200 1.02 100
> 627.837
>
> But do you need the "toggle" verb for a more general problem?
>
> Mike
>
> On 15/09/2010 14:54, Markus Schmidt-Gröttrup wrote:
>    
>> Is their a better way to create a verb that toggles as defined here?
>>
>>        toggle =: 4 : 0
>> t =: -. t
>> )
>>        t =: 0  NB. initialisation
>>
>> Consider the calculation that might occur in a bank, where growing
>> deposits yield a growing interest rate:
>>
>> 1.03*300+1.025*200+1.02*100
>>
>> To evaluate it the toggle verb allows to write:
>>
>>      (+`* @. toggle)/ 1.03 300 1.025 200 1.02 100
>>
>> I dislike the global variable (t), certainly there are better ways to do
>> the calculation.
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>      
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>    

-- 

Prof. Dr. M. Schmidt-Gröttrup
Hochschule Ulm,
Fakultät Grundlagen
Prittwitzstr. 10, 89075 Ulm
E-Mail: [email protected]
Tel:   +49 (0) 731 50 28036

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

Reply via email to