1. 17
  1.  

    1. 2

      Always nice to see practical examples of arraylangs!

      In Lil, the first part is reasonably compact if I fuse together the data-cleaning and sound-finding operations, using a shifted vector comparison since Lil lacks eachprior. Takes about 17 seconds to process 133,855 lines of dictionary data on my laptop, which is slower than I’d like:

      d:56 drop "\n" split read["cmudict-0.7b.txt"]
      followers:raze each x in d
       t:2 drop " " split x
       v:t in "R","L"
       extract where (0,v)&!v from t
      end
      mostcommon:extract orderby v desc from
       select k:first value v:count value by value from followers
      

      The second part can leverage Lil’s query syntax, and is pretty much instantaneous for a mere 3004 lines of CSV data:

      t:readcsv[read["ICC Test Bowl 3003.csv"] "ssiiiiisffiiis"]
      
      sorted: select orderby Wkts desc orderby Ave asc where Wkts from t
      best: select where !gindex by Wkts from sorted
      
      bestInClass: select where each v i in Ave v~min (i+1) take Ave end from best
      
      allWkts: sorted.Wkts
      mostCompetitive: extract where (gindex=0)&15<count gindex by value from allWkts
      mostCompetitiveBowlers: select where Wkts in mostCompetitive from best
      
      gap: min allWkts drop 1+range max allWkts