Re: Rosetta: Range extraction

2017-04-24 Thread breamoreboy
On Tuesday, April 25, 2017 at 12:13:42 AM UTC+1, Gregory Ewing wrote: > 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 suppos

Re: Rosetta: Range extraction

2017-04-24 Thread Gregory Ewing
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 -- https://mail.pyt

Re: Rosetta: Range extraction

2017-04-24 Thread bartc
On 24/04/2017 09:20, Robert L. wrote: Create a function that takes a list of integers in increasing order and returns a correctly formatted string in the range format. Use the function to compute and print the range formatted version of the following ordered list of integers. (The correct answe