Here's a problem. I'm not having trouble with cut and paste so could you show the working version.
Also do not remove caps [: from tacit results as they are needed for the explicit versions you are writing to work correctly. D=:[: (^~ >:)/ (2 3$0 1 0 1 0 0) +/ .* ] pmt1200a=:(%<:)@Da * 1 0 1 */ .# |value error: Da | pmt1200a=: (%<:)@Da*1 0 1*/ .# |[-1] c:\users\linda\j64-807-user\temp\15.ijs Linda -----Original Message----- From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of 'Rob Hodgkinson' via Programming Sent: Wednesday, September 12, 2018 11:26 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Tacit form: How to handle intermediate Hi Linda, Raul’s functions may be input to 13: as shown here: Raul’s functions: D=:[: (^~ >:)/ (2 3$0 1 0 1 0 0) +/ .* ] pmt1200a=:(%<:)@Da * 1 0 1 */ .# pmta=:pmt1200@(%&1200 1 1) pmta 5.75 240 12500 87.7604 Revised as input to 13 : (note in the below the space required between ’13’ and ‘:’ and that I have “removed” any tacit addons (such as [:) to exactly reproduce Raul’s tacit definitions ... Da=:13 : '(^~ >:)/ (2 3$0 1 0 1 0 0) +/ .* y’ NB. Removed the leading [: as not required for explicit (I could have left it in, but I’m trying to exactly reproduce Raul’s tacit definitions above), and added last term y to the explicit expression pmt1200a=: 13 : '(%<:)@Da * 1 0 1 */ .# y’ NB. Added last term y pmta=: 13 : 'pmt1200@(%&1200 1 1) y’ NB. Added last term y (although this is not required as composition can be applied directly as Raul did) without requiring explicit) NB. Let’s compare to Raul’s solution in email below ... Da [: (^~ >:)/ (2 3$0 1 0 1 0 0) +/ .* ] NB. Same definition as Raul pmt1200a [: (% <:)@Da [: * 1 0 1 */ .# ] NB. Same pmta pmt1200@(%&1200 1 1) pmta 5.75 240 12500 87.7604 HTH but if still unclear please expand ? For further reference re [: only having meaning in tacit form (which is why I removed it for explicit form) it may be helpful to read this link: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcode.jsoftware.com%2Fwiki%2FVocabulary%2Fsquarelfco&data=02%7C01%7C%7Cc059f09bd44446fc424708d61928c374%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724060199447363&sdata=OrnLHRv1N%2Fe5lnADLmIGobGEQkw5kxYmbnHMVx84AIs%3D&reserved=0 <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcode.jsoftware.com%2Fwiki%2FVocabulary%2Fsquarelfco&data=02%7C01%7C%7Cc059f09bd44446fc424708d61928c374%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724060199447363&sdata=OrnLHRv1N%2Fe5lnADLmIGobGEQkw5kxYmbnHMVx84AIs%3D&reserved=0> Thanks, Rob > On 13 Sep 2018, at 1:05 am, Linda Alvord <lindaalvor...@outlook.com> wrote: > > > > When you'e're done f=: 13 :'... > > enter > f > > If the result is tacit there will be no x or y. Instead you get a string of > separate J symbols which J uses from right to left to follow your > instructions. > > I need a laptop to check. Raul's function. > > Linda > > > > ' > > Sent from my Verizon, Samsung Galaxy smartphone > -------- Original message -------- > From: Raul Miller <rauldmil...@gmail.com > <mailto:rauldmil...@gmail.com>> > Date: 9/10/18 12:55 AM (GMT-05:00) > To: Programming forum <programm...@jsoftware.com > <mailto:programm...@jsoftware.com>> > Subject: Re: [Jprogramming] Tacit form: How to handle intermediate > > x=:0 is bad form, so I am going to ignore that part. > > In fact, I'd eliminate all internal =: from that definition and start with: > > pmt=: 3 : 0 > 0 pmt y > : > 'r t b'=. y > D=.(1 + r % 1200) ^ t > b*(r % 1200) * D % D - 1 > ) > > And our paranoia test is: > pmt 5.75 240 12500 > 87.7604 > > The next issue is that we're working with more than two values, that > makes it a bit complicated. > > On the other hand, we never use x - if it's provide we ignore it. So > I'm going to ignore it here. If that bothers you, use pmt=: pmt&] f. > after we've got the tacit expression. (Using f. on the final > expression will also protect from some damage if you happen to run the > original with it's D=: expression...). > > Anyways... > > To simplify this slightly, notice that we never want to use the value > of r. Instead, we always want r%1200. So we can divide y by 1200 1 1 > and work the remainder of the dyadic expression becomes: > > pmt1200=: 3 : 0 > 'r t b'=. y > D=.(1 + r) ^ t > b*r * D % D - 1 > ) > > A tacit expression to compute D directly from this y would be: > D=: [: (^~ >:)/ (2 3$0 1 0 1 0 0) +/ .* ] > > with that definition of D, pmt1200 can be > pmt1200 =: (%<:)@D * 1 0 1 */ .# ] > > and our tacit pmt becomes > pmt=: pmt1200@(%&1200 1 1) > > Trying it out: > pmt 5.75 240 12500 > 87.7604 > > Good enough? > > -- > Raul > On Sun, Sep 9, 2018 at 9:55 PM Linda Alvord <lindaalvor...@outlook.com > <mailto:lindaalvor...@outlook.com>> wrote: >> >> Here's a classic. Can anyone write this in tacit? >> >> NB. Mortgage is Rate Months Loan >> >> pmt=: 3 : 0 >> (x =: 0) pmt y >> : >> 'r t b'=:y >> D=:(1 + r % 1200) ^ t >> b*(r % 1200) * D % D - 1 >> ) >> >> pmt 5.75 240 12500 >> >> In 1961 I bought a house for $17,000. With a loan of $12,000 at 5.75 >> interest for 20 years. As a tenured teacher and a woman no bank would give >> me a mortgage but for 20 years I payed the previous woman owner $87.77. At >> the last payment it just so happened that I sold it. >> >> Linda >> >> -----Original Message----- >> From: Programming <programming-boun...@forums.jsoftware.com >> <mailto:programming-boun...@forums.jsoftware.com>> On Behalf Of 'Mike >> Day' via Programming >> Sent: Saturday, September 8, 2018 1:45 PM >> To: programm...@jsoftware.com <mailto:programm...@jsoftware.com> >> Subject: Re: [Jprogramming] Tacit form: How to handle intermediate >> >> Agreed on the "strong hint" in herona below. I got into that habit >> >> years ago in Fortran.... >> >> And Sorry for the unintentional extra characters. (I'm seeing >> >> A-circumflex where I'd typed space!) Just as well we're not talking APL! >> >> Mike >> >> >> On 08/09/2018 09:40, Martin Kreuzer wrote: >>> @Linda >>> >>> I think that your >>> heron=: 13 :'%:*/(s y),(s y)-y' >>> looks superior to my initial approach as it gathers _all four_ >>> factors under the (*/) Times Insert. >>> >>> btw "Hope you have good classes!" >>> >>> For quite some time, I don't have classes any more, but once in a >>> while do private tutoring; my last two students finished their >>> 'matura' at Easter this year (and one of them is on 'work & travel' >>> in New Zealand presently). >>> >>> @Mike >>> >>> Looking at your 'minor change' and the resulting tacit code, >>> methinks that (sy=. s - y) is giving the interpreter a much stronger >>> hint that there's a re-used intemediate result than the construct (' ... [ >>> s2=. >>> .... ') I used initially. >>> >>> -M >>> >>> At 2018-09-07 09:43, you wrote: >>> >>>> Fair enough, it looks neat, but doesn't deal with Martin >>>> Kreuzer's original requirement to apply s just the once, ie how >>>> should we handle the intermediate result, s? >>>> >>>> On the other hand, David Lambert and others propose variations on >>>> how to factor the formula so as to use the result of s. >>>> >>>> It's usually easy in explicit form, harder in tacit form. It >>>> seems to me that using 13 : ... is very helpful in developing a >>>> tacit form, but it often fails to spot opportunities to save >>>> intermediate results. 13 : ... isn't an optimising compiler - or >>>> is it? It certainly doesn't spot the opportunity to save the >>>> repeated (s y) in Linda's example. >>>> >>>> Somewhat to my surprise, a minor change to Linda's explicit >>>> expression does result in a single applicaton of s in a quite >>>> elegant tacit form: >>>> >>>>    herona=: 13 :'%:*/sy,(sy=.s y)-y' >>>> >>>>    herona 3 4 5 >>>> >>>> >>>> >>>>    herona 5 12 13 >>>> >>>> 30 >>>> >>>>    herona >>>> >>>> [: %: [: */ s ([ , -) ] >>>> >>>> >>>> Cheers, >>>> >>>> Mike >>>> >>>> On 07/09/2018 08:19, Linda Alvord wrote: >>>>> It keeps getting simpler: >>>> >>>>> s=: 13 :'-:+/y' >>>>> heron=: 13 :'%:*/(s y),(s y)-y' >>>>> heron 3 4 5 >>>>> heron 4 5 6 >>>>> d >>>> >>>> >>>>> ;:'[: -: +/' >>>> >>>>> heron >>>> >>>>> ;:'[: %: [: */ s , s - ]' >>>>> >>>> >>>>> Explisit sentences are like English and the new language is the >>>>> computers J anguage. First learn the words and then learn to read >>>>> ghe ords in sentences. And just as you might when learning >>>>> Spanish, you might in time begin to speak it. >>>> >>>>> Linda >>>> >>>> >>>>> -----Original Message----- >>>>> From: Programming <programming-boun...@forums.jsoftware.com> On >>>>> Behalf Of David Lambert >>>>> Sent: Thursday, September 6, 2018 6:11 PM >>>>> To: programming <programm...@jsoftware.com> >>>>> Subject: Re: [Jprogramming] Tacit form: How to handle intermediate >>>> >>>>> A hook can save recomputation. >>>> >>>>> (computation with original data and reused me) (resuse me) >>>> >>>> >>>>>   test=: [: %: ([: -: +/) * [: */ ([: -: +/) - ] >>>> >>>>>   NB. play with the half factor   f=:   4 %~ [: %: [: >>>>> */ (([ , (- +:))~ +/) >>>> >>>>>   NB. shorter >>>> >>>>>   NB.   c o m p u t a t i o n   r e u s e   g=:  >>>>>  ([: %: [: */ [ , -)~    ([: -: +/) >>>> >>>>>   g2=:  ([: %: [: */ [ , -)~ -:@:(+/) >>>> >>>> >>>>>   %/ (g , test) 3?@:$0 >>>>> 1 >>>> >>>> >>>>> On 09/04/2018 08:00 AM, programming-requ...@forums.jsoftware.com wrote: >>>>>> Date: Tue, 04 Sep 2018 11:50:43 +0000 >>>>>> From: Martin Kreuzer<i...@airkreuzer.com> >>>>>> To:programm...@jsoftware.com >>>>>> Subject: [Jprogramming] Tacit form: How to handle intermediate >>>>>> result..? >>>>>> Message-ID: >>>>>> <5b8e71a5.1c69fb81.65e5c.4a9esmtpin_added_miss...@mx.google.com> >>>>>> Content-Type: text/plain; charset="us-ascii"; format=flowed >>>>>> >>>>>> Hi all - >>>>>> >>>>>> To calculate the area of a flat triangle, using Heron's formula, >>>>>> A(a,b,c)= sqrt( s2*(s2-a)*(s2-b)*(s2-c) ) I wrote a simple >>>>>> function doing this: >>>>>> >>>>>> * get the three sides (as list input y) >>>>>> * compute the half perimeter s2 >>>>>> * build the differences s2-y >>>>>> * build product >>>>>> * take square root >>>>>> >>>>>> My explicit solution looks like this >>>>>> >>>>>> taher=: 13 : '%: s2 * */ s2-y [ s2=. -: +/ y' >>>>>> >>>>>> and works >>>>>> >>>>>> taher 3 4 5 >>>>>> 6 >>>>>> >>>>>> Suggested tacit version looks like this (and works too) >>>>>> >>>>>> tahert=: [: %: ([: -: +/) * [: */ ([: -: +/) - ] >>>>>> >>>>>> Q: Is there a way to reference the intermediate result of ([: -: >>>>>> +/) the half perimeter s2 within the tacit expression, as has >>>>>> +been >>>>>> done in the explicit..? >>>>>> [Guess the interpreter takes care of this anyway; my question >>>>>> aims at whether a shorter formulation could be reached.] >>>>>> >>>>>> Thanks >>>>>> -M >>>>> ------------------------------------------------------------------ >>>>> -- >>>>> -- >>>>> For information about J forums see >>>>> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fw >>>>> ww >>>>> .jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C8d2147240443485c >>>>> 7f >>>>> 8c08d61445ac18%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636718 >>>>> 68 >>>>> 6798916834&sdata=Yuys8QE3yMvBtUraCohR9dRgPugZDeNaNh3BoBCzJjU%3 >>>>> D& >>>>> amp;reserved=0 >>>>> ------------------------------------------------------------------ >>>>> -- >>>>> -- For information about J forums see >>>>> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fw >>>>> ww >>>>> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2F >>>>> www> .jsoftware.com >>>>> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2F >>>>> jsoftware.com%2F&data=02%7C01%7C%7Cc059f09bd44446fc424708d6192 >>>>> 8c374%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724060199447 >>>>> 363&sdata=7%2BW%2FWnVdGUyO5afICJRXaEqL4lZbDhslLmJ%2BUZmjYbA%3D >>>>> &reserved=0>%2Fforums.htm&data=02%7C01%7C%7Cfbcf68689bed4e >>>>> 31e2 >>>>> 8108d615b2cfcc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636720 >>>>> 25 >>>>> 5064176871&sdata=0sleKYElksLSP%2BOT8BYYtyzcuL3GTBuL14taSrgJQS8 >>>>> %3 >>>>> D&reserved=0 >>>> >>>> >>>> >>>> --- >>>> This email has been checked for viruses by Avast antivirus software. >>>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw >>>> ww >>>> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F >>>> www> .avast.com >>>> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fa >>>> vast.com%2F&data=02%7C01%7C%7Cc059f09bd44446fc424708d61928c374% >>>> 7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724060199447363& >>>> ;sdata=XUS7U9Sp%2Fsu9gliyJpYPu%2BHef8xB0i5gk5HcNcCNgWY%3D&reser >>>> ved=0>%2Fantivirus&data=02%7C01%7C%7Cfbcf68689bed4e31e28108d6 >>>> 15b2cfcc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6367202550641 >>>> 76 >>>> 871&sdata=kMQGWHLjMejRbJOuSn5EvWU4j39TqVPCX73QNKV6k7g%3D&re >>>> se >>>> rved=0 >>>> ------------------------------------------------------------------- >>>> -- >>>> - For information about J forums see >>>> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww >>>> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww>. >>>> jsoftware.com >>>> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fj >>>> software.com%2F&data=02%7C01%7C%7Cc059f09bd44446fc424708d61928c >>>> 374%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724060199447363 >>>> &sdata=7%2BW%2FWnVdGUyO5afICJRXaEqL4lZbDhslLmJ%2BUZmjYbA%3D& >>>> ;reserved=0>%2Fforums.htm&data=02%7C01%7C%7Cfbcf68689bed4e31e28 >>>> 1 >>>> 08d615b2cfcc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636720255 >>>> 06 >>>> 4176871&sdata=0sleKYElksLSP%2BOT8BYYtyzcuL3GTBuL14taSrgJQS8%3D& >>>> am >>>> p;reserved=0 >>> >>> -------------------------------------------------------------------- >>> -- >>> For information about J forums see >>> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww >>> .j >>> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fww >>> w.j> software.com >>> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fso >>> ftware.com%2F&data=02%7C01%7C%7Cc059f09bd44446fc424708d61928c374 >>> %7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724060199447363& >>> ;sdata=I5dd02BNrDeI3jYXGw0GcF7sw%2BdPwPm2Fx4TjtCFsXI%3D&reserved >>> =0>%2Fforums.htm&data=02%7C01%7C%7Cfbcf68689bed4e31e28108 >>> d615b2cfcc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636720255064 >>> 17 >>> 6871&sdata=0sleKYElksLSP%2BOT8BYYtyzcuL3GTBuL14taSrgJQS8%3D& >>> re >>> served=0 >> >> --------------------------------------------------------------------- >> - For information about J forums see >> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww. >> jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cfbcf68689bed4e31e281 >> 08d615b2cfcc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63672025506 >> 4176871&sdata=0sleKYElksLSP%2BOT8BYYtyzcuL3GTBuL14taSrgJQS8%3D&am >> p;reserved=0 >> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww >> .jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cfbcf68689bed4e31e28 >> 108d615b2cfcc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6367202550 >> 64176871&sdata=0sleKYElksLSP%2BOT8BYYtyzcuL3GTBuL14taSrgJQS8%3D&a >> mp;reserved=0> >> --------------------------------------------------------------------- >> - For information about J forums see >> https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww. >> jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Ce7a73deaeb854a9b4fc2 >> 08d616d9b2cc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63672152158 >> 8434559&sdata=EFzoMQ0co%2BInvoiD40hpSqWLJ6gWZVRGz4EbFGlJOcQ%3D&am >> p;reserved=0 >> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww >> .jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Ce7a73deaeb854a9b4fc >> 208d616d9b2cc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6367215215 >> 88434559&sdata=EFzoMQ0co%2BInvoiD40hpSqWLJ6gWZVRGz4EbFGlJOcQ%3D&a >> mp;reserved=0> > ---------------------------------------------------------------------- > For information about J forums see > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j > software.com%2Fforums.htm&data=02%7C01%7C%7Ce7a73deaeb854a9b4fc208 > d616d9b2cc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63672152158843 > 4559&sdata=EFzoMQ0co%2BInvoiD40hpSqWLJ6gWZVRGz4EbFGlJOcQ%3D&re > served=0 > <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww. > jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Ce7a73deaeb854a9b4fc20 > 8d616d9b2cc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6367215215884 > 34559&sdata=EFzoMQ0co%2BInvoiD40hpSqWLJ6gWZVRGz4EbFGlJOcQ%3D&r > eserved=0> > ---------------------------------------------------------------------- > For information about J forums see > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j > software.com%2Fforums.htm&data=02%7C01%7C%7Cc059f09bd44446fc424708 > d61928c374%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63672406019944 > 7363&sdata=b9I4sMX5jSddFL6qyxLiN3W1DBv2S51N1UjbNoO6zVQ%3D&rese > rved=0 > <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww. > jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cc059f09bd44446fc42470 > 8d61928c374%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6367240601994 > 47363&sdata=b9I4sMX5jSddFL6qyxLiN3W1DBv2S51N1UjbNoO6zVQ%3D&res > erved=0> ---------------------------------------------------------------------- For information about J forums see https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cc059f09bd44446fc424708d61928c374%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636724060199447363&sdata=b9I4sMX5jSddFL6qyxLiN3W1DBv2S51N1UjbNoO6zVQ%3D&reserved=0 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm