Thanks Raul,
Even though a better way emerged, you got me to a solution without @ or &
but it was a struggle!
]A=:'/9@Z`z'
/9@Z`z
a.#~2|a.i.&0@/:@,"{A
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
k=: 13 :'a.#~2|(a.([:/:,)"0 1 y) (i."1) 0'
k A
0123456789ABCDEFGHIJKL
The median of list 1 2 2 4 6 is 2 ("middle" value of sorted list), the median
of 2 2 4 6 is 3 (average of two "middle" values). Write a verb to find the
median of a sorted list of numbers.
--Kip Murray
Sent from my iPad
--
F
On Sun, Mar 10, 2013 at 6:29 PM, km wrote:
> The median of list 1 2 2 4 6 is 2 ("middle" value of sorted list), the
> median of 2 2 4 6 is 3 (average of two "middle" values). Write a verb to
> find the median of a sorted list of numbers.
Here's one implementation of this definition of median:
which is pretty close to the implementation in the stats/base addon
midpt=: -:@<:@#
median=: -:@(+/)@((<. , >.)@midpt { /:~)
On Mon, Mar 11, 2013 at 1:48 PM, Raul Miller wrote:
> On Sun, Mar 10, 2013 at 6:29 PM, km wrote:
> > The median of list 1 2 2 4 6 is 2 ("middle" value of sorted list),
Very neat, thank you. I won't show you my lengthy solution which led me to
call for help! --Kip
Sent from my iPad
On Mar 10, 2013, at 7:48 PM, Raul Miller wrote:
> On Sun, Mar 10, 2013 at 6:29 PM, km wrote:
>> The median of list 1 2 2 4 6 is 2 ("middle" value of sorted list), the
>> medi