The 13 : interpreter module translates code from one representation and
generates code in another representation, so could be classified as a
compiler.

The f. adjective doesn’t.

Thanks,

—
Raul

On Saturday, September 8, 2018, Martin Kreuzer <i...@airkreuzer.com> wrote:

> At 2018-09-08 17:44, you wrote:
>
> Agreed on the "strong hint" in herona below.  I got into that habit
>> years ago in Fortran....
>>
>
> btw, when using (13 :) in
>    f=. 13 : ' ... '
> and afterwards calling (f)
> is that a call to a special (symbolic) J compiler or
> just to an interpreter module..?
>
>
> 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!
>>
>
> Never mind - I'm beginning to get used of that.
> It's a multi-layered/complex problem;
> one probable contributor is my rather vintage EMail Client (Qualcomm
> Eudora v7),
> -which I still use on WinX (with some difficulty)-
> others are foreign mail servers of certain providers.
>
> -M
>
>
> 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.protec
>>>>> tion.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%
>>>>> 2Fforums.htm&amp;data=02%7C01%7C%7C8d2147240443485c7f8c08d61
>>>>> 445ac18%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6367186
>>>>> 86798916834&amp;sdata=Yuys8QE3yMvBtUraCohR9dRgPugZDeNaNh3BoB
>>>>> CzJjU%3D&amp;reserved=0
>>>>> ----------------------------------------------------------------------
>>>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>>>
>>>>
>>>>
>>>>
>>>> ---
>>>> 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
>>>>
>>>
>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
> ----------------------------------------------------------------------
> 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