I can never remember that -- and looking it up each time breaks my
train-of-thought.
So I have the following bozo utilities permanently defined in my z-locale:
cr=: [: 5!:5 boxopen NB. linear repn of id: y
crr=: 3 : '(>y),''=: '',cr y' NB. re-input line to redefine foo. crr<'foo'
rep=: verb define
NB. choice of verb representation
if. 0=$,y do. 'atomic boxed tree linear paren monadic dyadic'
else. 'l' rep y NB. your favorite here
end.
:
NB. x can be just the first letter...
select. {.x
case. {.'atomic' do. 5!:1 <y
case. {.'boxed' do. 5!:2 <y
case. {.'tree' do. 5!:4 <y
case. {.'linear' do. 5!:5 <y
case. {.'paren' do. 5!:6 <y
case. {.'monadic' do. (1)5!:7 <y
case. {.'dyadic' do. (2)5!:7 <y
end.
)
rep''
--prompts me with the available x-options. Then I can see, for instance:
'm' rep 'rep'
Incidentally, rep works for nouns too...
z=: 'alpha' ; 'bravo' ; 'charlie'
rep'z'
<;._1 ' alpha bravo charlie'
...which tells me more than I might have been expecting.
But this is what I find myself using most of all (because I'm lazy and
I like re-inputtable stuff)...
crr'dtb'
dtb=: #~ ([: +./\. ' '&~:)
...letting you rapidly define an analogous word to strip trailing linefeeds...
dtlf=: #~ ([: +./\. LF&~:)
On Mon, May 23, 2011 at 2:44 AM, Fraser Jackson
<[email protected]> wrote:
> Define the form to be used with the foreign conjunction
>
> 9!:3 ] 2
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm