Jump to content

Talk:Averages/Median

From Rosetta Code

jq: error: missing 'try'

Hi;

 When trying the jq task I get:
 
jq -f ./median.jq ./in.dat
jq: error: Top-level program not given (try ".")
jq: 1 compile error

---Retired Build Engineer (talk) 05:24, 28 November 2024 (UTC)

Swift example fails

averages_median.swift:52:7: warning: expression implicitly coerced from 'Double?' to 'Any'
50 |
51 | var c: [Double] = (0...100).map {_ in Double.random(in: 0...100)}
52 | print(c.median())
   |       | |- note: provide a default value to avoid this warning
   |       | |- note: force-unwrap the value to avoid this warning
   |       | `- note: explicitly cast to 'Any' with 'as Any' to silence this warning
   |       `- warning: expression implicitly coerced from 'Double?' to 'Any'
53 |

averages_median.swift:33:57: error: extra argument 'subrange' in call
31 | 			while true {
32 | 				let splitVal = self.randomElement(within: lower..<upper)
33 | 				let partitionIndex =  self.partition(subrange: lower..<upper, by: {$0 > splitVal})
   |                                                         `- error: extra argument 'subrange' in call
34 | 				switch partitionIndex {
35 | 				case goal: return partitionIndex

---Retired Build Engineer (talk) 07:02, 28 November 2024 (UTC)

Cookies help us deliver our services. By using our services, you agree to our use of cookies.