[Jprogramming] k programming challenge
Joe Bogner
joebogner at gmail.com
Wed Jan 27 21:03:25 UTC 2016
somewhat silly, but I wanted to try it out with regex
I also borrowed Raul's writedsv
txt=:fread 'c:/temp/const.txt'
('solution.txt';'|';'') writedsv~ |."1 }. \:~ (#;{.)/.~ (#~ 0&= @ {.@{. @
('[a-z]+'&rxmatch)) @ tolower each (rxcut~ ('[();:\s.,]')&rxmatches) txt
I may not have the punctuation list correct
On Wed, Jan 27, 2016 at 3:11 PM, Raul Miller <rauldmiller at gmail.com> wrote:
> Ah, I see, yes, I left out the output stage...
>
> I guess if I were to include the writing-to-file stage, I'd probably
> do it something like this:
>
> require'csv web/gethttp'
> const=: gethttp 'http://usconstitution.net/const.txt'
> words=: [: ;: ' '"_`(I.@:= toupper)`]}~@tolower
> ('solution.txt';'|';'') writedsv~ |."1\:~ (<@#/.~,.~.)words const
>
> And I guess I shouldn't be so careless as to leave out steps...
>
> Thanks,
>
> --
> Raul
>
>
> On Wed, Jan 27, 2016 at 3:00 PM, Raul Miller <rauldmiller at gmail.com>
> wrote:
> > On Wed, Jan 27, 2016 at 2:34 PM, chris burke <cburke at jsoftware.com>
> wrote:
> >> Note that this solution adheres to the I/O requirements of the
> challenge.
> >
> > I think any solution which downloads the text of the constitution from
> > http://usconstitution.net/const.txt would adhere to those I/O
> > requirements?
> >
> > Thanks,
> >
> > --
> > Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list