Here is an "assignment hook" definition called that
way for what we might expect "(=: f) myvar" to do...
(myvar=: f myvar).
ah=: 2 : 0
". (m. ,'=: ',(": v@". m.))
)
t=: 2
't' ah +:
4
t
4
't' ah +: + 1
9
t
8
't' ah (+&6) + 1
15
There's something about J behaviour I dont think is a
good idea below though... A syntax error will still
cause part of a sentence to execute. For example:
t=: 4
't' ah +: 1
|syntax error
| 't'ah+:1
t
8
(t was reassigned despite the full sentence failing)
I'm sure preformance benefits from this, but I'd vote
for a switch/FC that put a transaction around all (for
a switch) or the following sentence (if a FC), such
that if it fails all assignments are rolled back.
> >
> > If you want a reference rather than a value, why
> not simply quote
> > the name?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm