2005-12-13

J Dirty hack

Thanks to dr_klm, who implicitly pointed to the unexpected feature:

Here is the expected behavior of the fork and operator @


load 'system/packages/misc/fndisplay.ijs'
setfnform 'Jv'
defverbs 'F G H'
defnouns 'y'

(F G@H ]) y
+---------------+
|G_ (F_ y) _H_ y|
+---------------+

If it were not for..

Exetuting:

(2&+@i.@# %@(+/\) ]) i.4
1 0.333333 0.2
0.333333 0.166667 0
0.166667 0 0
0 0 0
%((2&+@i.@# i.4) (+/\) (] i.4))
1 0.333333 0.2
0.333333 0.166667 _
0.166667 _ _
_ _ _

Obviously, records that supposed to be equivalent are really not, due to the presence of the implicit operation — filling with zeros.

I doubt whether I should enjoy this feature, or not. If there is no trouble in recognition of the operation in the code, it can even be a beautiful solution.

No comments:

Post a Comment