Timeline for Implement wc (word count) shortest code wins
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 15, 2014 at 19:52 | comment | added | Vlo |
We can define variable in argument + define length() to save some characters - 87 now. sum(n<-nchar(x<-scan(,"",se="\n")));(l=length)(x);max(n);sum(sapply(strsplit(x," "),l))
|
|
Dec 8, 2011 at 3:15 | comment | added | Ari B. Friedman | @Tommy Yup. And I believe that's actually 91 characters if you count the \ and the n separately :-O | |
Dec 7, 2011 at 18:55 | comment | added | Tommy |
A little shorter: x=scan(,"",se="\n");n=nchar(x);sum(n);l=length;l(x);max(n);sum(sapply(strsplit(x," "),l))
|
|
Dec 7, 2011 at 18:05 | history | edited | Ari B. Friedman | CC BY-SA 3.0 |
added 192 characters in body
|
Dec 7, 2011 at 16:45 | history | answered | Ari B. Friedman | CC BY-SA 3.0 |