"
If the first example was in an equivalent to tacit code, it could not
call f. It would have to be like this:
4 (.x).`(.y (. y , x + {: y ). x $: <: y). at .(.x < y). 8
It would be impossible to use in a larger tacit program and you'd need
Jx to solve that, as far as I understand.
Same problem as in tacit J today.
I didn't manage to use $: from explicit J.
/Erling

On 2017-09-30 18:28, Erling Hellenäs wrote:
> Hi all !
>
>      4(f=. 4 : 'x (4 : ''x'')`(4 : ''s,y +{: s=.x f <: y'')@.(4 :''x <
> y'') y' )8
>
> 4 9 15 22 30
"

Beware of line-wrapping...

One can always produce, in principle, for any explicit verb a corresponding
tacit verb.  Ocasionally, this might be a difficult task; this is not in
this case,

   4 (f=. 4 : 'x (4 : ''x'')`(4 : ''s,y +{: s=.x f <: y'')@.(4 :''x < y'')
y' ) 8
4 9 15 22 30

   4 (f=. [`(] (] , [ + {:@:]) [ $: <:@:])@.<) 8
4 9 15 22 30

After I rewrote f tacitly I realized that this explicit verb was the
transcription of a tacit verb :D (although I suspect the original tacit
verb itself was a transcription of an explicit version).

"
4 (.x).`(.y (. y , x + {: y ). x $: <: y). at .(.x < y). 8
It would be impossible to use in a larger tacit program and you'd need
"

At any rate, it is very easy, in Jx, to embed a tacit version of the verb f
within a larger tacit verb and fix it, for instance,

   4 (1 + f)   8
5 10 16 23 31

   4 (1 + f)f. 8
5 10 16 23 31

The reason is Jx's recursive scope O.0,

     (1 + f)f.
1 + [`(] (] , [ + {:@:]) [ $: <:@:])@.<O.0

One cannot do that in J,

   JVERSION
Engine: j806/j64avx/windows
Beta-6: commercial/2017-09-26T14:05:48
Library: 8.06.07
Qt IDE: 1.6.1/5.6.3
Platform: Win 64
Installer: J806 install
InstallPath: c:/program files/j64-806
Contact: www.jsoftware.com

   4 (f=. [`(] (] , [ + {:@:]) [ $: <:@:])@.<) 8
4 9 15 22 30

   4 (1 + f)   8
5 10 16 23 31

   4 (1 + f)f.   8
5 10 16 23 31

   (1 + f)f.  NB. The larger verb in not a (pure) tacit verb anymore...
1 + 3 : '[`(] (] , [ + {:@:]) [ $: <:@:])@.< y' :(4 : 'x [`(] (] , [ +
{:@:]) [ $: <:@:])@.< y')

unless, one is prepared to use the darkest side of the force (which Jx
promotes), see [0, 1]

   4 (1 + (f f.)dRS) 8
5 10 16 23 31

   (1 + (f f.)dRS)
1 + ,^:(0:``:)&6 :.(<@:((,'0') ,&:< ]))@:([ , (<[`(] (] , [ + {:@:]) [ $:
<:@:])@.<) , ])&:(<@:((,'0') ,&:< ]))

This is just one of the otherwise apparently impossible feats for those who
choose to always obey the Dictionary's sacred commandments ;)

References

[0] [Jprogramming] Adverbial Tacit Jym  Jose Mario Quintana
    http://www.jsoftware.com/pipermail/programming/2016-May/045156.html

[1] J Wicked Toolkit
    http://www.2bestsystems.com/foundation/j/Jx.zip
    \Jx\J\J Wicked Toolkit.ijs


On Sat, Sep 30, 2017 at 12:57 PM, Erling Hellenäs <[email protected]>
wrote:

> If the first example was in an equivalent to tacit code, it could not call
> f. It would have to be like this:
> 4 (.x).`(.y (. y , x + {: y ). x $: <: y).@.(.x < y). 8
> It would be impossible to use in a larger tacit program and you'd need Jx
> to solve that, as far as I understand.
> Same problem as in tacit J today.
> I didn't manage to use $: from explicit J.
> /Erling
>
>
> On 2017-09-30 18:28, Erling Hellenäs wrote:
>
>> Hi all !
>>
>>      4(f=. 4 : 'x (4 : ''x'')`(4 : ''s,y +{: s=.x f <: y'')@.(4 :''x <
>> y'') y' )8
>>
>> 4 9 15 22 30
>>
>> Here we have another example of the Henry syntax:
>>
>> 4(f=.(.x (.x).`(.y (. y , x + {: y ). x f <: y).@.(.x < y). y).)8
>>
>> s is here the right unnamed operand of (. y , x + {: y ).  . As long as
>> you have variables, like in explicit code, you can keep s if you want. Like
>> this:
>>
>> 4(f=.(.x (.x).`(. s , y + {: s=. x f <: y).@.(.x < y). y).)8
>>
>>
>> Cheers,
>>
>> Erling
>>
>>
>> On 2017-09-30 16:24, Erling Hellenäs wrote:
>>
>>> Hi all!
>>>
>>> Yes, well,  I wanted to measure differences between tacit and explicit
>>> expressions as such, so I tried to avoid unrelated processing time. In
>>> case  you have significant operations, these differences disappear, of
>>> course, and the processing time in these operations dominate over
>>> interpretation time or small differences in the code generated.
>>> It seems better to create an internal loop then to have ts loop a big
>>> number of times over a very small load, since the measurement process as
>>> such might dominate in the latter case.
>>> The way you measure, you have to set v low and n high to avoid
>>> processing time, and it seems you didn't.
>>> I understand that these differences might not be important in practice.
>>> Thanks for your judgement on that.
>>> Any other opinions about performance differences between tacit and
>>> explicit code? Are there any cases when they are big?
>>>
>>>    ts=: 6!:2 , 7!:2@]       NB. Time and space
>>>    v=.1
>>>    n=.5000000
>>>    n ts'(3 :''-y'')@:- v'
>>> 3.03253e_6 6784
>>>    n ts'(-)@:- v'
>>> 4.83682e_7 1152
>>>    v=.?~n
>>>    ts'(3 :''-y'')@- v'
>>> 1.8912 1.34712e9
>>>    ts'(-)@- v'
>>> 0.93178 1.34711e9
>>>
>>> Cheers,
>>> Erling
>>>
>>>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to