[Jprogramming] k programming challenge

Raul Miller rauldmiller at gmail.com
Wed Jan 27 05:15:36 UTC 2016


I guess I'd be inclined to do it like this:

require'web/gethttp'
const=: gethttp 'http://usconstitution.net/const.txt'
words=: [: ;: ' '"_`(I.@:= toupper)`]}~@tolower

   \:~ (<@#/.~,.~.)words const
+---+-----+
|727|the  |
+---+-----+
|495|of   |
+---+-----+
|306|shall|
+---+-----+
|264|and  |
+---+-----+
|202|to   |
...

Though of course, it's possible to format that result differently.

Thanks,

-- 
Raul



On Tue, Jan 26, 2016 at 5:29 PM, Roger Hui <rogerhui.canada at gmail.com> wrote:
> http://kxcommunity.com/kx-student-programming-challenge-us-constitution-word-count.php
>
> J solution, anyone?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


More information about the Programming mailing list