More ways to generate ARs doesn't hurt, but its not verbs returning non-nouns,
or a path (n:) to obtain non-nouns from a verb phrase, so then the proposal is
not meeting a major need.
repeating definitions,
eval_z_ =: 1 : 'if. 2 ~: 3!:0 m do. m else. a: 1 : m end.' NB.1 : ' a: 1 : m'
isNoun_z_ =: (0 = 4!:0 ( :: 0:))@:<
aar =: 1 : 'if. isNoun ''u'' do. q =. m eval else. q =. u end. 5!:1 < ''q'' '
Cloak=: aar(0:`)(,^:)
X=: 1 : 'm&+'
to answer your hypothetical DV question, it is actually possible to box verbs.
'X' Cloak(<@)("0) i.3 3
┌────┬────┬───┐
│00&+│01&+│2&+│
├────┼────┼───┤
│3&+ │4&+ │5&+│
├────┼────┼───┤
│6&+ │7&+ │8&+│
└────┴────┴───┘
('x3 x4' =. ('X' Cloak(<@)("0) 3 4))
x3
3&+
x3 2
5
using boxed verbs does require fishing them out, and an ar adverb (('ar' oa)
instead of (<@) makes them more "flexible". Parser and display seem
resilient/solid to these shenanigans.
On Tuesday, January 17, 2023 at 06:53:15 p.m. EST, Henry Rich
<[email protected]> wrote:
Verbs are first-class in J, in that they can be passed as ARs or by name
and invoked in an explicit verb. Nothing more is needed.
If a programmer is restricted to the tacit language (why? - I dunno)
verbs cannot be first-class. That seems to matter to some people. I
was trying to give them something. I don't love the proposal either,
but it seems pretty harmless.
Any dangerous verb that attempts to return a non-noun is going to be
crash-prone. What would DV"0 (6 6)$'+' mean? Its result is what type?
what shape?
I haven't followed the proposals closely. All I know is that having a
verb return a non-noun is going to create havoc inside JE.
Henry Rich
On 1/17/2023 6:42 PM, Elijah Stone wrote:
> I don't love the proposal, as I think a conception of verbs as first
> class should involve _less_ hackery with representations, not more.
> But I don't feel that strongly either way.
>
> More fruitful, IMO, would be to work out how to add closures, as I
> think there is a more urgent need for that (u./v. is a band-aid).
> Perhaps taking inspiration from kernel (but skipping the mutation!).
>
> On Mon, 16 Jan 2023, Henry Rich wrote:
>
>> I have never understood the zeal for having verbs return verbs, but
>> it must be real if some are willing to use dangerous backdoor hacks
>> into JE to achieve it. ARs make it possible to pass verbs around, but
>> executing them requires dropping into explicit code. To remedy this,
>> I offer a proposal, backward compatible with older J:
>>
>> 1. (". y) and Apply (x 128!:2 y) to be modified so that if the result
>> of execution is not a noun, it is replaced by its AR (instead of ''
>> as previously).
>>
>> 2. (". y) and Apply to be modified so that if y (for ".) or x (for
>> Apply) is boxed, the sentence is executed as usual except that each
>> box is converted using (box 5!:0) before being put onto the execution
>> stack.
>>
>> The idea is that you can execute (".
>> expr-producing-AR,exp-producing-AR,...) without having to get any
>> modifiers involved.
>>
>> Sentence execution can produce ARs, and can take ARs created by verbs
>> to represent verbs and modifiers. That sounds pretty classy to me,
>> but I don't know whether it's first-class.
>>
>> Henry Rich
>>
>>
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm