r←SortHeader fn_name;header;inter;nr;vars ⍝ Sort the Header of a Function ⍝ ⍝ fn_name = Function Name
⍝ Nested Representation of Function nr←⎕NR fn_name
⍝ Removes the extra Blanks at the End of each line of the Function nr←(-¯1+(⌽¨' '=¨nr)⍳¨0)↓¨nr
⍝ Extract the Header of the Function header←1⊃nr
⍝ Check if there is local variables to sort in header :If ~';'∊header ⍝ no ';' in header. Return without fixing the function. r←'' ⋄ →0 :Else ⍝ There is local variables in Header ⍝ Split the Header vars←(header⍳';')↓header
User command ]reordLocals will do that for you. In 12 or 11 you'll have to use Spice to get at it since UCMD don't exist in those versions. ]?reordlocals for details
Thanks Daniel, for functions ]reordlocals worked, thank you. But for a class does not seem to work (I have no return message that it has done something and looking back at the class it has done nothing). Anything special I should know about using this user command with a class ?
You are correct, the 12.1 version only works on fns and ops. I will see if that can be done for scripted nss/classes. Probably not before the conference tho.
Alphabetizing is trivial if one can transform a class/namespace into a character list, an inverse []fx if you will. Does such a function exist? Only working with the texts of :Namespace's and :Class'es via []ed seems to be a crippling limitation.
I think that ⎕src and its inverse ⎕fix are what you're looking for. )ed and the keystroke Shift-Enter or the UNIX equivalent are other options rather than ⎕ed
[updated 2010-12-03] Sorry about that .. the cut and paste looked good where I did it from !