That works awesome. It will also work for adverbs/ conjunctions too!
9!:14 ''
j601/2006-09-04/09:20
on my version, this shorter version produces the same results, including
passing your test case.
refname=:4 :0
NB. x - name of member
NB. y - locale
nm=. x,'_',(":>y),'_'
)
OO2def=:2 :0
nm=.m refname n
".'t=.',nm
if.0=4!:0<'t' do.t=.".bind nm end.
(5!:1<'t')5!:0
)
----- Original Message ----
From: "Miller, Raul D" <[EMAIL PROTECTED]>
To: Programming forum <[email protected]>
Sent: Monday, October 30, 2006 4:04:19 PM
Subject: RE: [Jprogramming] passing object functions to other objects
Pascal Jasmin wrote:
> I believe I have seen before a way to define both monad and
> dyad parts of a verb on the same line. Is there a way to have
> a single function that would return this verb?
> (nm,'@]')
> :
> ('[',nm,']')
This should work:
a:1 :(nm,'@]') :(a:1 :('[',nm,']')
That struck me as excessive bulk for a result,so I didn't go
that route.
Note also that this should work in j6.01, and is ambivalent
about verb valence:
refname=:4 :0
NB. x - name of member
NB. y - locale
nm=. x,'_',(":>y),'_'
)
v0=:2 :0
nm=.m refname n
".'dElEtEmE=:',nm
if.0=4!:0<'dElEtEmE' do.dElEtEmE=:".bind nm end.
nm2=.dElEtEmE
(5!:1<'nm2')5!:0
)
'a' v0 'base' NB. when (a) has verb syntax
a_base_
Caution: This won't work without at least temporary existence
of a non-local variable (in other words replacing both instances
of dElEtEmE=: with dElEtEmE=. will result in undesired behavior).
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm