Rosetta: Range extraction

Gregory Ewing greg.ewing at canterbury.ac.nz
Mon Apr 24 19:13:29 EDT 2017


bartc wrote:
> On 24/04/2017 09:20, Robert L. wrote:
> 
>> old = list[0]
>> list.slice_before{|n| [n-old>1,old=n][0]}.
>> map{|a| a.size<3 ? a.join(",") : [a[0],a[-1]].join("-")}.
>> join ","
> 
> Is this supposed to be Python code?

I think it's Ruby. Maybe posted to the wrong group?

-- 
Greg


More information about the Python-list mailing list