Re:Most Pressed Keys and Programming Syntaxes
by dredmorbius on Thursday September 08, 2011 @04:50PM
(#2975605)
What would be interesting here would be a difference analysis or regression giving the preference for any given key in a given language. E.g.: '|' is highly predictive of shell, '$' of perl, '()' for lisp. Might be fun to do in R.
Re:Most Pressed Keys and Programming Syntaxes
by pwnguin on Thursday September 08, 2011 @08:00PM
(#2976198)
I really need to do reading and research on this, but I'm pretty sure that's what Hidden Markov Models are for. You could watch a webpage go from HTML to javascript and back!
Re:Most Pressed Keys and Programming Syntaxes
by zokier on Thursday September 08, 2011 @08:53PM
(#2976318)
Could I ask for one more data: the total number of characters and maybe lines? That way symbol/alpha/line ratios could be compared to other languages.
Re:Most Pressed Keys and Programming Syntaxes
by alextgordon on Friday September 09, 2011 @02:00AM
(#2977039)
Yeah, when I get a chance I'll gather together some stats on all the languages I have data on (about 40).
Finder reports 630,942,867 bytes for the whole directory. Assuming most files will be plain ASCII, that should give a good approximation for the total number of characters.
Re:Most Pressed Keys and Programming Syntaxes
by zokier on Friday September 09, 2011 @03:48AM
(#2977303)
Based on those numbers I gathered some stats about keyboard layouts:
* 18% of all characters are symbols, 12% are spaces and 70% are alphabetic
* 20% of all non-space characters are symbols and 80% are alphabetic.
* US kb layout users need to use shift for 64% of symbols
* Finnish/Swedish kb layout users need to use shift for 73% of symbols and AltGr for 7% of symbols.
* Fi/Swe layout users thus need to use 25% more modifer keys for symbols.
Conclusion: Fi/Swe layout sucks.
edit: https://gist.github.com/1205728 python script used to get these numbers (percentages calculated with OOo Calc).
Re:Most Pressed Keys and Programming Syntaxes
by troxy on Thursday September 08, 2011 @09:03PM
(#2976345)
Do you know why you have slightly different numbers of (){}[] characters? In C or C++ shouldn't those all be paired up to match?
Re:Most Pressed Keys and Programming Syntaxes
by zeteo on Thursday September 08, 2011 @09:22PM
(#2976382)
It can probably be accounted for by comments (e.g. people sometimes comment out half a block). Although the comments should be left out, so as not to mix the C and the English.
Re:Most Pressed Keys and Programming Syntaxes
by alextgordon on Friday September 09, 2011 @01:47AM
(#2977007)
Also string and character literals. It's common to write something like
if (c == '{')
and not need to test for the matching one.
Re:Most Pressed Keys and Programming Syntaxes
by zokier on Friday September 09, 2011 @05:33AM
(#2977493)
Heatmap for symbols only: http://i.imgur.com/yc6fe.png
The raw counts for symbol characters: