mitmath/computational-thinking

Varible red overrides function in hw1.jl

goalaleo opened this issue · 1 comments

For week 1 in Exercise 2.3 the student is required to write a function to quantize instances of subtypes of AbstractRGB e.g. RGB. The live docs imply that the functions red(c) green(c) and blue(c) can be used to "pull out" the RGB values from a pixel.

Screenshot 2021-01-17 at 22 29 19

However, the function red(c) is overwritten by a later variable assignment to red on L301

https://github.com/mitmath/18S191/blob/14ca6fa5178f5c0025c5e845c7c40b7ea219d0dd/homework/homework1/hw1.jl#L301

This causes an error to be displayed if the student assumes that red is a function, and tries to call it
Screenshot 2021-01-17 at 22 29 56

Commenting out the variable assignment reverts the function override
Screenshot 2021-01-17 at 22 30 54


I suggest that the variable red should be renamed to something like color_red to avoid overriding the function