New DirectDefinition representation

39 views
Skip to first unread message

Joshua Y

unread,
Oct 15, 2024, 9:32:07 PM10/15/24
to forum
J9.6.0-beta11 added the following feature: -
    Direct definitions (created using {{ }}) are displayed on the console with {{ }}

Will this representation be made available via the (5!:n) family?

Henry Rich

unread,
Oct 15, 2024, 10:32:03 PM10/15/24
to fo...@jsoftware.com

No, because a lot of code expects the old format for the 5!:5 result. Nested DDs use {{ }} but not the outermost.

Henry Rich


To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Henry Rich

unread,
Oct 15, 2024, 10:33:35 PM10/15/24
to fo...@jsoftware.com

We could always add features. Why do you want the {{ }} form?

Henry Rich

Joshua Y

unread,
Oct 15, 2024, 11:13:29 PM10/15/24
to forum, Henry Rich
  > Why do you want the {{ }} form?
Selfish reasons. I use a custom REPL with syntax highlighting, and currently verbs are represented with `5!:5`.


  > a lot of code expects the old format for the 5!:5 result.
I didn't expect the output of `5!:5` would change, but maybe a new Foreign (eg. `5!:8`) could be provided.

Like I said, selfish reasons... it's a very niche use-case - so not very important - but I thought I'd at least ask.

Raul Miller

unread,
Oct 16, 2024, 12:22:08 AM10/16/24
to fo...@jsoftware.com
It's probably worth noting that this is a J sentence:

F=: {{
echo y
x!y
}}

But this is not a J sentence:

4 : 0
echo y
x!y
)

In other words, the result of 5!:5 cannot be reliably used by J's ". verb.

This tends to come up when building conjunctions which try to work
with the textual representation of verbs.

--
Raul

Henry Rich

unread,
Oct 16, 2024, 11:37:28 AM10/16/24
to forum
Use 0!:x rather than ".

Henry Rich 

Raul Miller

unread,
Oct 16, 2024, 11:44:41 PM10/16/24
to fo...@jsoftware.com
That works great if the purpose is to construct a sentence like F=: u
(for example: 'F=: ',5!:5<'u')

It's significantly less useful if the purpose is to construct a
sentence like u C v

Hypothetically speaking, I guess the facility could be implemented in
a library. But since we've already got something like it at the
command line, it might be simpler to expose the mechanism as a new
foreign.

(Note also: in the general case, to preserve 'name-like syntax', the
serialized form should be wrapped in '( ' and ')'. But I guess it
would be viable to push that into user space for every such usage of
the mechanism.)

Thanks,

--
Raul
Reply all
Reply to author
Forward
0 new messages