Richard,

I recollect something similar but I've lost the reference.

At the time I slightly expanded the demo as below, so any mistakes will be mine.

Each display shows how the expansion is created so the last line is the final 
execution.
Also you have to ignore the outer brackets in that final line. 

I hope this helps.

Rob.

NB. Verb train demo

dd=:1!:2&2

x=:'x' [ y =: 'y'

f=: 3 : 0
dd '(f ',y,')'
:
dd '(',x,' f ',y,')'
)
g=: 3 : 0
dd '(g ',y,')'
:
dd '(',x,' g ',y,')'
)
h=: 3 : 0
dd '(h ',y,')'
:
dd '(',x,' h ',y,')'
)
e=: 3 : 0
dd '(e ',y,')'
:
dd '(',x,' e ',y,')'
)
d=: 3 : 0
dd '(d ',y,')'
:
dd '(',x,' d ',y,')'
)
c=: 3 : 0
dd '(c ',y,')'
:
dd '(',x,' c ',y,')'
)


dd 'monad f y, dyad x f y'
f y
x f y
dd 'monad hook (f g) y'
(f g) y
dd 'dyad hook x (f g) y'
x (f g) y
dd 'reverse hook - (g~ f) y'
(g~ f) y
dd 'monad fork (f g h) y'
(f g h) y
dd 'dyad fork x (f g h) y'
x (f g h) y
dd '4 train monad (e f g h) y'
(e f g h) y
dd '4 train dyad x (e f g h) y'
x (e f g h) y
dd '5 train monad (d e f g h) y'
(d e f g h) y
dd '5 train dyad x (d e f g h) y'
x (d e f g h) y
dd '6 train monad (c d e f g h) y'
(c d e f g h) y
dd '6 train dyad x (c d e f g h) y'
x (c d e f g h) y
dd 'bracketed train eg.. ((e f) (g h)) y'
((e f) (g h)) y
dd 'bracketed train eg.. x ((e f) (g h)) y'
x ((e f) (g h)) y
dd 'bracketed train eg.. ((e f g) h) y'
((e f g) h) y
dd 'bracketed train eg.. x ((e f g) h) y'
x ((e f g) h) y





> On 24 Oct 2022, at 06:45, 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

Reply via email to