Re: [Jprogramming] Tacit form: How to handle intermediate result..?

2018-09-07 Thread Martin Kreuzer
@Louis I must admit that I had forgotten about (or even never heard of) Brahmagupta's formula for the area of a cyclic quadrilateral. Treating Heron's formula as a special case of the former makes indeed an elegant solution. Thanks for pointing that out. -M At 2018-09-05 01:25, you wrote:

Re: [Jprogramming] Tacit form: How to handle intermediate

2018-09-07 Thread 'Mike Day' via Programming
Yes, although I thought the non-f. version showed s happened to be "saved" on this occasion... Mike On 07/09/2018 15:17, Raul Miller wrote: You can always find cases which optimizing compilers don't deal with (because there's infinities of those). That said, in this case, I think it's worth

Re: [Jprogramming] Tacit form: How to handle intermediate result..?

2018-09-07 Thread Martin Kreuzer
@Martin At 2018-09-04 20:34, you wrote: What *does* matter is that using such auxiliary functions is *good*. Eugene McDonnell was a great teacher demonstrating elegant, readable code composed out of useful little parts. Thanks for the reminder and encouragement -- I now remember having had p

Re: [Jprogramming] Tacit form: How to handle intermediate

2018-09-07 Thread Raul Miller
You can always find cases which optimizing compilers don't deal with (because there's infinities of those). That said, in this case, I think it's worth looking at the result of herona f. Thanks, -- Raul On Fri, Sep 7, 2018 at 5:43 AM 'Mike Day' via Programming wrote: > > Fair enough, it look

Re: [Jprogramming] Tacit form: How to handle intermediate result..?

2018-09-07 Thread Martin Kreuzer
@Michael Thanks -- yes, I do ... (And coincidentally, it's along the same lines as Mike day's 2nd suggestion a day later.) -M At 2018-09-04 14:06, you wrote: Did you mean something like this? f=: -:@(+/) %:@([* */@:-) ] f 3 4 5 On Tue, Sep 4, 2018, 10:01 AM Raul Miller, wrote: >

Re: [Jprogramming] Tacit form: How to handle intermediate

2018-09-07 Thread 'Mike Day' via Programming
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'

Re: [Jprogramming] Tacit form: How to handle intermediate

2018-09-07 Thread Linda Alvord
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 s