Henry wrote:
>...
>line_producing_the_desired_result
>if. unmap_jmf_... do. end.
>)

Yes, at one point I had:

           line_producing_the_desired_result
           assert. 1 [ unmap_jmf_ ...

But I didn't like it, and since it added a line to my definition anyway, I 
opted for the more obvious and readable  IP=. ...  .

By the way, here's something you might find cute.  Remember the diamond symbol 
from APL?  There's an equivalent in J:

           3 : ' ''execute'' label_. ''from'' label_. ''left to right'' ' 0
        left to right
           
Dependable, and no side effects.  Won't help with the "unmap needs to be called 
after the result is calculated, but the result calculated is the result 
returned" situation, but might be useful in others.

Raul wrote:
>  Given that the dictionary defines an order of execution

First, leveraging that order demands requires care and forethought [1], which 
seems a large price to avoid using an extra line (in particular for code 
maintenance, as I might change the ultimate line without bearing in mind the 
subtleties of order-of-execution).

Second, The Dictionary is subject to change without notice.

-Dan

[1] Fun with order of execution:

           0 0$(smoutput 'first')[smoutput 'second'
        first
        second

           0 0$(smoutput 'first')[(smoutput 'second')
        second
        first

           0 0$(smoutput 'first')[ ASSIGNMENT=:smoutput 'second'
        second
        first

            0 0$(smoutput 'first') ] smoutput 'second'
        first
        second

            NB.  Ok, so parens get done first...
            NB. 
            NB.  Which means I can do an assignment in the 
            NB.  parens and use the assignment later in the line...

            0 0$(smoutput A=:'first') ] smoutput '2: ', A 
        |domain error
        |   0 0$(smoutput A=:'first')]smoutput'2: '    ,A

            NB.  Huh. Guess not.


            NB. Check this one out:         
           (smoutput 'first') 1 :'u'  smoutput 'second'
        first

            NB.  Theoretically, the assignment is idempotent wrt. the
            NB.  result of the line (i.e. it's just a side-effect)...
           (smoutput 'first') 1 :'u'  ASSIGNMENT=:smoutput 'second'
        second
        first
        |syntax error
        |       (smoutput'first')1 :'u'ASSIGNMENT=:smoutput'second'
           
All of which are just curiosities, unless you're depending upon side effects.  
Which, of course, is exactly what we're doing in the "unmap" situation.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to