Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!shlump.nac.dec.com!decuac!haven!ni.umd.edu!uc780.umd.edu!cs450a03 From: cs450a03@uc780.umd.edu Newsgroups: comp.lang.apl Subject: RE: JKT replies to EEM re: histograms Message-ID: <4APR91.20043819@uc780.umd.edu> Date: 4 Apr 91 20:04:38 GMT References: <1991Apr4.002052.24661@yrloc.ipsa.reuter.COM> Sender: usenet@ni.umd.edu (USENET News System) Organization: The University of Maryland University College Lines: 25 Nntp-Posting-Host: uc780.umd.edu Joey Tuttle writes: > > #/.~,y > >is what I have asked for in the past in APL. By making a special >performance case of (#/.~), a problem which has always been >"inappropriate for APL because of performance" could be solved very >nicely. what's wrong with v =. /:, y k =. k # i. $k=. 1, (_1}.v) ~: 1}. v hist =. k - ($k){. 0,k here, /: is O(n log n) (where n is the length of v) and everything is is O(n) Also note that k{v is the nub of ,y Yeah, this version will blow up if y is empty, but that is easily handled (either as a special case, by coercing k, or by choosing a different algorithm to check adjecency when computing k). Raul Rockwell