In J a list need not be sorted. But my problem statement said "sorted list" and you have a nice solution. About "list" see
http://www.jsoftware.com/docs/help701/dictionary/dicta.htm --Kip Sent from my iPad On Mar 11, 2013, at 7:02 AM, Robert Knight <theknightrep...@gmail.com> wrote: > I am a long-time APL lover and new student of J, who has yet to learn the > language's more elegant idioms. However, if "list" is defined as > a sorted one-dimensional vector, the following clumsily-written function > seems to work as stipulated in the problem: > > *median =: 3 : '-:+/(<.-:(#y)-0 0.5){y'* > > I enjoy this forum and welcome any improvements or tips > > -Robert Knight > > > On Sun, Mar 10, 2013 at 6:29 PM, km <k...@math.uh.edu> 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. >> >> --Kip Murray > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm