How would you define better?
If you are looking for economy of expression, I'd probably leave that
leading space in place, and stick the file in the J system directory:
/:~(~.,.<@#/.~)',' {:@cut&> 'b' freads 'jconf2014'
┌────────────┬──┐
│ Canada │14│
├────────────┼──┤
│ Denmark │2 │
├────────────┼──┤
│ Finland │2 │
├────────────┼──┤
│ Germany │1 │
├────────────┼──┤
│ Hong Kong │2 │
├────────────┼──┤
│ Switzerland│1 │
├────────────┼──┤
│ UK │2 │
├────────────┼──┤
│ USA │20│
└────────────┴──┘
Note that I've assumed you've used copy and paste to grab just the attendee
list from a rendered instance of the conference page.
Note also that this is an equivalent expression in my case (though, with a
messy file, freads is probably safer to use):
/:~(~.,.<@#/.~){:@cut~&',';._2 fread 'jconf2014'
Thanks,
--
Raul
On Tue, Jul 1, 2014 at 12:21 PM, Lippu Esa <[email protected]> wrote:
> Hello all!
>
> I was looking at the J Conference 2014 attendee list (//
> www.jsoftware.com/jwiki/Community/Conference2014) and was pleased to see
> that we are so many!
>
> Naturally I wanted to see the country distribution of the attendees. Being
> an eternal novice I'd like to see alternative (i.e. better :) ) solutions
> to this.
>
> sort (~.,.[:<"0[:+/"1=) }.@>@{: each ',' cut each 'b' freads
> 'h:/data/j/jconf2014'
>
> +--------------+
> ¦Canada ¦14¦
> +-----------+--¦
> ¦Denmark ¦2 ¦
> +-----------+--¦
> ¦Finland ¦2 ¦
> +-----------+--¦
> ¦Germany ¦1 ¦
> +-----------+--¦
> ¦Hong Kong ¦2 ¦
> +-----------+--¦
> ¦Switzerland¦1 ¦
> +-----------+--¦
> ¦UK ¦2 ¦
> +-----------+--¦
> ¦USA ¦20¦
> +--------------+
>
> See you soon!
>
> Esa
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm