Here is my first attempt at solving this:
george=:3 :0
tree=. (<@{~ ?~&#)\ y
;@|."1 ' '&,&.> tree NB. pad
)
george 'abcde'
a
a b
c b a
d c b a
e a d b c
Hopefully it is clear that the first line generates a scrambled tree,
and the second line formats it for display.
I think I prefer explicit definitions over other tacit forms, for
implementations that use long chains of monads, because of the
concatenative quality of explicit definitions.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm