You must have wanted to write

taher2= 13 : '%: (S2 y) * */ (S2 y) - y'

instead of

taher2=: 13 : '%: (S2 y) * */ S2-y

Cheers,
Louis

> On 6 Sep 2018, at 09:26, Linda Alvord <[email protected]> wrote:
> 
> I got a domain error. Is this right (in a complex plane)? 
> 
> 
>      S2=: 13 :'-:+/y'
> 
>      taher2=: 13 : '%: (S2 y)* */ S2-y NB.[ S2=. -: +/ y'
> 
>   S2 3 4 5
> 6
> 
>   taher2 3 4 5
> 0j6
> 
>   taher2
> [: %: S2 * [: */ [: S2 -
> 
> 
>   ;:'[: %: ([: -: +/) * [: */ ([: -: +/) - ]'
> ┌──┬──┬─┬──┬──┬─┬─┬─┬─┬──┬─┬─┬─┬──┬──┬─┬─┬─┬─┬─┐
> │[:│%:│(│[:│-:│+│/│)│*│[:│*│/│(│[:│-:│+│/│)│-│]│
> └──┴──┴─┴──┴──┴─┴─┴─┴─┴──┴─┴─┴─┴──┴──┴─┴─┴─┴─┴─┘
> 
> I'm more and more convinced that humans should write
> Using  13 :, and then study boxed tacit.  In this Cap 
> Tells me to think halve not match. Use times with insert not with things to 
> the right. Finally use square root 
> not root.
> 
> Hope you have good classes!  
> 
> Linda
> 
>   -----Original Message-----
> From: Programming <[email protected]> On Behalf Of 
> Cliff Reiter
> Sent: Tuesday, September 4, 2018 8:52 AM
> To: [email protected]
> Subject: Re: [Jprogramming] Tacit form: How to handle intermediate result..?
> 
> Your 13 created a tacit verb
> 
>    taher=: 13 : '%: s2 * */ s2-y [ s2=. -: +/ y'
>    taher
> [: %: ([: -: +/) * [: */ ([: -: +/) - ]
> 
> 
>> On 9/4/2018 7:50 AM, Martin Kreuzer wrote:
>> 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%2Fwww.j
>> software.com%2Fforums.htm&amp;data=02%7C01%7C%7C54f7c9bbd6b348dff2c508
>> d612653f7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63671662339303
>> 7195&amp;sdata=x4R6JLnq1eX9JJ4REKcEmgY2eTHoc49xApSgXlAfPc8%3D&amp;rese
>> rved=0
> 
> ----------------------------------------------------------------------
> For information about J forums see 
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&amp;data=02%7C01%7C%7C54f7c9bbd6b348dff2c508d612653f7d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636716623393037195&amp;sdata=x4R6JLnq1eX9JJ4REKcEmgY2eTHoc49xApSgXlAfPc8%3D&amp;reserved=0
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to