http://qs321.pair.com?node_id=145460


in reply to (Golf) Keysort

Update 2: demerphq reminded me that his code returns the list. My code has been updated to do so, and comes in at 106:
# this is LEXICAL sorting #2345678901234567890123456789012345678901234567890123 sub JAPHY { sort{(*-,*+)=map[/^\s*(0|-?[1-9]\d{0,8})(.*)$/],$a,$b ;@-?@+?$-[0]-$+[0]||$-[1]cmp$+[1]:-1:@+?1:$a cmp$b}@_ }

Update: new code under 100, at 98... oh, notice how I'm leaving that space in between $a and cmp? If it's legal for me to put a newline there and not have it count, let me know.
#234567890123456789012345678901234567890123456789 sub JAPHY { (*-,*+)=map[/^\s*(0|-?[1-9]\d{0,8})(.*)$/],$a,$b; @-?@+?$-[0]-$+[0]||$-[1]cmp$+[1]:-1:@+?1:$a cmp$b }

Here's my sorting function, with a healthy count of 107:
#2345678901234567890123456789012345678901234567890123456 sub JAPHY { my($A,$B)=map[/^\s*(0|-?[1-9]\d{0,8})(.*)$/],$a,$b; @$A?@$B?$$A[0]-$$B[0]||$$A[1]cmp$$B[1]:-1:@$B?1:$a cmp$b }

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who could use a job
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;