I do not think that I said that 5!:5 produces erroneous results.

I think I said that when non-nouns are involved that the result of
5!:5 may not be a suitable ". argument.

Here's an example:

example=:3 :0
   a=:'this'
   b=:a,' is a'
   b,y
)

With that definition, this works:

   example i.0

But in J grammar you can replace a name with a parenthesized copy, or
a parenthesized copy of its definition.

And, of course, this works:

   (example)i.0

But, this does not (you get a spelling error):

   ex=: 5!:5<'example'  NB. serialize the definition of 'example'
   ".'(',ex,')i.0'

That said, I was also overly optimistic when I said that the result of
5!:5 is valid in 0!: contexts, because this also fails:

   0!:101'(',ex,')i.0'

It would be possible to build a 0!:101 argument that behaves like
example i.0, and where the definition of example is preserved so that
the script could be executed at a later time and still produce the
same result even if the word 'example' had changed. But that approach
would involve updating a name to represent the earlier definition of
'example'.

Long and short of it is that J currently does not have a simple and
robust interface for serializing definitions of non-nouns for use in J
sentences.

(I hope I am making sense?)

Thanks,

-- 
Raul

On Tue, Feb 4, 2020 at 12:45 PM Henry Rich <henryhr...@gmail.com> wrote:
>
> If you know of cases where 5!:5 produces an erroneous result, please put
> them on the bug list.  I have fixed all that I have seen.
>
> Of course, ". cannot produce a non-noun result.
>
> Henry Rich
>
> On 2/4/2020 12:15 PM, Raul Miller wrote:
> > Perhaps also of note is that J has supports several forms of
> > serialization (as well as similar operations), though they each have
> > their limitations.
> >
> > If you are working with nouns, 5!:5 is probably the best serialization
> > mechanism (and, when working with nouns, 5!:6 is equivalent):
> >
> >     X=: i.2 3
> >     5!:5<'X'
> > i.2 3
> >     5!:6<'X'
> > i.2 3
> >
> > Remember that you need to parenthesize this kind of result, at least
> > in some contexts.
> >
> > That said, note that -- if you're going to be using 5!:5 (or 5!:6) for
> > things that are not nouns -- its results are designed for use in 0!:
> > contexts and not all of the results will work in ". contexts.
> >
> > FYI,
> >
>
> ----------------------------------------------------------------------
> 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