I prefer ({.,#)/.~ from the unbeatable
http://www.jsoftware.com/books/pdf/brief.pdf (section 23).
Other Jems galore.
({.,#)/.~ 10 40 10 10 20 30 40
10 3
40 2
20 1
30 1
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Martin Pelletier
> Verzonden: vrijdag 13 augustus 2010 19:03
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Jems
>
> EuclidianDistance =: |@-
>
> (0 j. 0) EuclidianDistance (5 j. 4)
> 6.40312
>
> TimeToSeconds =: _ 60 60 #. ]
> TimeToSeconds 12 10 4
> 43804
>
> I also like nubcount from the 'misc' library
>
> nubcount=: ~. ;"_1 #/.~
> nubcount 10 40 10 10 20 30 40
> ┌──┬─┐
> │10│3│
> ├──┼─┤
> │40│2│
> ├──┼─┤
> │20│1│
> ├──┼─┤
> │30│1│
> └──┴─┘
>
> And sort
>
> sort=: /:~ : /:
>
> Martin Pelletier
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm