kaxori
09/18/2024, 5:51 PMfloitsch
09/18/2024, 8:37 PMoutput-poits
- it's generally more efficient to use custom classes than lists. It might make sense to have a Hsv or Rgb class.
- in `transform`: the for i := 1; i < in.size; i += 1. You can use i++.
- if you do floating-point operations
- typically we use american English (normalize instead of normalise). Obviously not enforced.
- these lines don't fully make sense:
y := out.first
if x <= in.first: y = out.first
Did you mean y/num := ? ?kaxori
09/19/2024, 7:59 AMfloitsch
09/19/2024, 8:12 AMreduce for the `transform`:
in.reduce: | previous current |
if x <= current:
x-norm/float := normalise x.to-float previous current
return scale x-norm previous current
current // Use 'current' as the next previous.kaxori
09/19/2024, 2:59 PMy := in.reduce: | previous current |
if x <= current:
x-norm/float := normalize x.to-float previous current
scale x-norm previous current
else:
current
('return' was not accepted)
But I think there is a disadvantage, because each list element is handledfloitsch
09/19/2024, 3:00 PMreturn should be fine. What was the error?floitsch
09/19/2024, 3:00 PMfloitsch
09/19/2024, 3:03 PM_.
The trailing _ is for privacy of globals and fields.