Again, smaller sub-units help to avoid such accidents:

        sort =: /:~
        de_space =: -.&' '
        normalize =: de_space@sort@tolower
        isAnagramOf =: -:&normalize

Almost every time, these tiny sub-units provide something useful even
beyond of the current context ("anagrams").  They are certainly easier
to test/verify.

Emphatically agreed.  And also take a moment to decide the proper rank for a 
verb.  Here,
isAnagramOf applies only to lists, so define it as

isAnagramOf =: -:&:normalize"1   NB. & would be OK too

de_space might reasonably be rank 1 as well.


It also makes reasoning about the ranks of the components easier.
In consequence, it becomes easier to make an educated selection
between  @ vs @:  or & vs &:  -- much better than to stick blindly
to some mysterious rule of thumb.

I would rather say that the goal is to understand why the rule of thumb is not 
mysterious.
The first step is to note that there is a difference between & and &:, @ and @:,
and &. and &.: - something many J newcomers pick up late.

Henry Rich


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

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

Reply via email to