nixcloud / tour_of_nix

Sourcecode to the https://nixcloud.io/tour/ 'a tour of nix'

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make desired functionality of min and max more clear in chapter 8

BottomNotch opened this issue · comments

I got hung up on this for a few minutes because I didn't understand the desired functionality of min and max. I created a function that took an input and a minimum value, and returned the input if it were greater than given minimum value, otherwise returned the minimum value (and did similarly for the max function). This worked as I expected but was very confused and frustrated when I was told it wasn't the expected solution. Eventually I looked up the min and max functions in Noogle and discovered where I went wrong.

It would be very helpful for noobs like me to either explain how min and max are supposed to work, or alternatively encourage the user to look up the functions on noogle before writing their own implementation.

update the question like this:

grafik

hope you like this, if not reopen ;-)

thank you, that's perfect