NB. I've purged most of the earlier posts (below)

Martin Kreuzer's original question was how to handle intermediate results!

Anyway, staying off topic for now,  Ric's tongue-in-cheek proposal is "explicit",
but perhaps you wanted something more so, Linda.

He's got a point, though - would you like it reexpressed in COBOL?

Meanwhile, this _might_ be along the lines you're thinking of:

NB. Ric's tacit verb
pmt=: {: * 1&{ (([: (% <:) (^~ >:)) * ]) 1200 %~ {.

NB. attempt to render it explicit... (explicate it?)
pmte =: 3 : 0
'r t b'   =. y % 1200 1 1
NB. OR: b =. {:y [ t =. 1{y [ r =: 1200%~ {:y  NB.!!!
NB. (^~ >:)                   ===>
incrtot   =. t^~1 + r
NB. OR:   =. (1 + r)^t
NB. ([: (% <:) (^~ >:))       ===>  incrtot % incrtot - 1
NB. (([: (% <:) (^~ >:)) * ]) ===> (incrtot % incrtot - 1) * r
NB. whole thing ===>
b * (incrtot % incrtot - 1) * r
)

BTW, the fragment, incrtot % incrtot - 1, suggests a further refinement -
or is it? - dealing with an intermediate result,  anyway!
incrtot % incrtot - 1
1 % 1 - 1 % incrtot
% 1 - % incrtot
-.&.% incrtot     NB. too tacit?

NB. Also, my antiallergenic tacit version avoiding @ and @:
pmtmd =: [: (*`(] * [: (% <:) (^~ >:))/) 1 1 1200 %~ |.

   'r t b'=. 5.75 240 12500
   (pmt, pmte, pmtmd) r,t,b
87.7604 87.7604 87.7604

FWIW!

Mike


On 11/09/2018 07:58, Ric Sherlock wrote:
Linda,
You may want to define exactly what you mean by "explicitly" and what
you're trying to show/achieve.
Here is a tongue-in-cheek potential solution to your request:

pmt=: 13 : '({: * 1&{ (([: (% <:) (^~ >:)) * ]) 1200 %~ {.) y'

On Tue, Sep 11, 2018 at 2:21 PM Linda Alvord <lindaalvor...@outlook.com>
wrote:

Now can someone, not Ric, write his version explicitly.

PMT=:  13  :
Linda

Sent from my Verizon, Samsung Galaxy smartphone


-------- Original message --------
From: Ric Sherlock <tikk...@gmail.com>
Date: 9/10/18 7:04 PM (GMT-05:00)
To: Programming JForum <programm...@jsoftware.com>
Subject: Re: [Jprogramming] Tacit form: How to handle intermediate

Without @, but IMO this is a case where @ definitely improves readability!

pmt=: {: * 1&{ (([: (% <:) (^~ >:)) * ]) 1200 %~ {.


On Tue, Sep 11, 2018 at 7:06 AM Linda Alvord <lindaalvor...@outlook.com>
wrote:

What if I'm allergic to @ ?

Linda




[snipped the rest - Mike]

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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

Reply via email to