Er... actually, I should have gone with

fork=: {{)a
  0!:0'u=. {{u (',(5!:6<'u'),') v}}'
  u
}}

This still has a problem in some cases, but this fixes some other
problems which I had not been thinking about.

Thanks,

-- 
Raul

On Tue, Sep 28, 2021 at 11:46 AM Raul Miller <[email protected]> wrote:
>
> However, a "hook adverb" is relatively easy to create tacitly:
>
> hook=: ]:
>
> Ok, ok... that's actually a joke, since the hook formation happens
> outside of the adverb (and, thus, is vulnerable to adjacent nouns in
> the sentence).
>
> Still... it's relatively straightforward to create an explicit fork adverb:
>
> fork=: {{)a
>   ".'u=. {{u ',(5!:6<'u'),' v}}'
>   u
> }}
>
>    +/ % fork # 1 2 3
> 2
>
> (Granted, this will have problems in some cases because of a
> limitation of the current 5!:6 implementation. We could detect those
> cases and work around the problem, but doing that would contribute
> nothing useful here.)
>
> But, ... anyways, having actual language primitives for hook and fork
> might be useful for the tacit construction crowd.
>
> It's just kind of ironic that the simplest hook primitive would be a
> conjunction while the simplest fork primitive would be an adverb.
>
> Thanks,
>
> --
> Raul
>
> On Tue, Sep 28, 2021 at 6:14 AM Elijah Stone <[email protected]> wrote:
> >
> > On Mon, 27 Sep 2021, Henry Rich wrote:
> >
> > > All I would be interested in reading is a SHORT example of something
> > > that can't be done without changing the language.
> >
> > Currently possible, but very inconvenient: define a 'hook' conjunction
> > tacitly.  (Useless as such, but useful if one wishes to produce a hook
> > from a tacit modifier, as I did.)  I was able to come up with the
> > following abomination: ']. (([:(]: ]: ])) (]:~) [) [.'.  Compare with the
> > explicit {{u v}}.  (It simplifies if one cares only about the monadic
> > case, which was the case for me, but not by much.)
> >
> > I propose a conjunctive fork: interpret C0 C1 (which is currently
> > meaningless) as (u C0 v) (u C1 v).
> >
> > This doesn't solve the more general problem of producing arbitrary
> > forks-- _some_ arrangement of C0 C1 C2 should give u C0 v  u C1 v  u C2 v
> > --but would still be helpful.
> >
> >   -E
> > ----------------------------------------------------------------------
> > 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