Actually, thinking about this, a series of related essays might be useful.

I'm not quite sure how they should be labeled. But using J to build
expression-like results to illustrate concepts seems like a general
and illustrative technique for beginners. (Though of course it's also
useful for addons, like the math/calculus package.)

Thanks,

-- 
Raul

On Tue, Oct 25, 2022 at 10:49 AM Raul Miller <rauldmil...@gmail.com> wrote:
>
> Given the character of this work, it might be more useful as an essay,
> rather than an addon.
>
> That said, it could also be rewritten to be more compact. For example:
>
> bracket=: 3 :0
>   if. 1=#y=.":y do. y else. '(',y,')' end.
> )
>
> instance=: 1 :0
>  m,'_',bracket y
> :
>  (bracket x),'_',m,'_',bracket y
> )
>
> instances=: 3 :0
>   (y,'_z_')=:(y)=:y instance
>   EMPTY
> )
>
> linstances=: 3 :0
>  instances y [ instances y,'l'
> )
>
> linstances"0 'fghi'
>
> (Though, also, here, the first and =: declaration could be made to be
> more compact -- using the new {{ }} explicit form they could be made
> single line declarations with possibly improved clarity.)
>
> Thanks,
>
> --
> Raul
>
> On Tue, Oct 25, 2022 at 9:55 AM chris burke <cbu...@jsoftware.com> wrote:
> >
> > I think this is Simon Garland's fgh script, which used to be
> > distributed in system/packages/misc/fgh.ijs. For example:
> >
> >    load '~temp/fgh.ijs'
> >
> >    0 f g h 1
> > 0 _f_ (g_ (h_ 1))
> >
> >
> >    0 (f g h) 1
> > (0 _f_ 1) _g_ (0 _h_ 1)
> >
> > The script is below. Perhaps someone could check it, and then we put
> > it in the addons?
> >
> > -----------------------
> >
> > NB. fgh.ijs
> > NB.
> > NB. displays calling sequence for simple J expressions, where:
> > NB.
> > NB.   f_       monadic f
> > NB.   _f_      dyadic f
> > NB.   _fI_     dyadic inverse of f etc..
> > NB.
> > NB. e.g.
> > NB.   f g h 0
> > NB.   (f g h) 0
> > NB.   f&g 0
> > NB.   f&.g 0
> > NB.   0 f g 1
> > NB.   f/1 2 3
> >
> > bracket=: 3 : 0
> > if. (1=$,y=.":y) do. y
> > else. '(',y,')' end.
> > )
> >
> > f=: 3 : 0
> > 'f_ ',bracket y
> > :
> > (bracket x),' _f_ ',bracket y
> > )
> >
> > g=: 3 : 0
> > 'g_ ',bracket y
> > :
> > (bracket x),' _g_ ',bracket y
> > )
> >
> > h=: 3 : 0
> > 'h_ ',bracket y
> > :
> > (bracket x),' _h_ ',bracket y
> > )
> >
> > i=: 3 : 0
> > 'i_ ',bracket y
> > :
> > (bracket x),' _i_ ',bracket y
> > )
> >
> > fI=: 3 : 0
> > 'fI_ ',bracket y
> > :
> > (bracket x),' _fI_ ',bracket y
> > )
> >
> > gI=: 3 : 0
> > 'gI_ ',bracket y
> > :
> > (bracket x),' _gI_ ',bracket y
> > )
> >
> > hI=: 3 : 0
> > 'hI_ ',bracket y
> > :
> > (bracket x),' _hI_ ',bracket y
> > )
> >
> > iI=: 3 : 0
> > 'iI_ ',bracket y
> > :
> > (bracket x),' _iI_ ',bracket y
> > )
> >
> > NB. definitions in z locale:
> > f_z_=: f_fgh_ :. fI_fgh_
> > g_z_=: g_fgh_ :. gI_fgh_
> > h_z_=: h_fgh_ :. hI_fgh_
> > i_z_=: i_fgh_ :. iI_fgh_
> >
> > On Sun, Oct 23, 2022 at 10:45 PM Richard Donovan <rsdono...@hotmail.com> 
> > wrote:
> > >
> > > Many years ago (J4 or J6) I remember there was a function that showed how 
> > > hooks and trains etc were expanded, using such output as x _f_ g_ y etc 
> > > (where _f_ indicated dyad etc). Does anyone know of this and whether it 
> > > still exists?
> > >
> > > Thanks in advance
> > > ----------------------------------------------------------------------
> > > 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

Reply via email to