My a2 name :)
InfinityAdverb=: (`(<(":0);_)) (`:6)
%InfinityAdverb
0
/Erling
On 2017-10-21 20:45, Raul Miller wrote:
Here's one issue:
1 2 3 *: av
1 4 9
load'debug/dissect'
dissect '1 2 3 *: av'
Syntax error: invalid sequence Noun Verb
Error snippet: 1 2 3 *: av
But that's not a syntax error.
And, for reference, here are two distinct implementations of av. First
an explicit approximation:
LR=: 5!:5@<
LRA=:1 :0
(LR 'u'),' m'
)
AV=:1 :0
1 :(u LRA)
)
Second, a restatement of Jose's code (but with a few different names):
ar=: 5!:1@:<
bGerund=: `''
Compose=: (@:[) ((<'&')`) (`:6)
a2=: (`(<(":0);_)) (`:6)
av=: ((ar'bGerund')`) (`(ar'Compose')) (`(ar'a2') ) (`:6)
I am still trying to think up a good name for a2 - roughly speaking
it's a placeholder which winds up being ignored in the result of the
Compose verb. I was interested in what dissect had to show me about
the evaluation process here, but that's not relevant to this problem,
which you can see by replacing av with AV.
#################################################
That said, it's perhaps also interesting that trace is also buggy:
trace '1 2 3 *: AV'
--------------- 5 Fork -------
1 2 3
*:
AV
1 2 3 *: AV
==============================
The problem seems to be an incomplete handling of locales. While trace
executes in the jtrace locale, the sentence it is executing comes from
a different locale (typically the base locale). This means that 4!:0
in movet treats AV as an undefined name (and, thus, a verb).
A quick and dirty fix would be to add
coinsert 'base'
to the top of addons/general/misc/trace.ijs (right under cocurrent'jtrace').
This has two flaws but it's still better than nothing:
(1) it won't work when trying to trace in another locale,
(2) it will still shadow base names with jtrace names.
Problem 2 could be avoided by replacing uses of 4!:0 and ". with names
which are defined in the z locale (nc and do), and suffixing them with
locale references. Still not perfect (because relies on z), but
implementations which shadow z are already dubious.
I have no idea about problem 1 - maybe documentation would be the best
solution there. (Another possibility would be to add feature to the
locale support, to detect locale of the caller - but I can't think of
any non-obfuscation uses of that feature. And, yes, ... I guess I
might have to include "making jtrace automatically work regardless of
the current locale of the global session" as obfuscation. I am not
sure about that...)
#################################################
Anyways, since this is getting long, I have reported two problems here:
(1) An invalid "syntax error" in dissect
(2) A serious name resolution problem in trace
Thanks,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm