Skip to content

Conversation

@Zesky665
Copy link

@Zesky665 Zesky665 commented Aug 1, 2016

The given answer failed to account for qty values above 20. In the case of the "banana" item, it returned an freeQty value of 6. In the exercise description it states "Purchases of 5 or more receive 1 free. Purchases of 10 or more receive 3 free". The original code added +3 for each 10 instead of +3 if qty is >= 10. Great course otherwise :) .

The given answer failed to account for qty values above 20. In the case of the "banana" item, it returned an freeQty value of 6.  In the exercise description it states "Purchases of 5 or more receive 1 free.  Purchases of 10 or more receive 3 free". The original code added +3 for each 10 instead of +3 if qty is >= 10.  Great course otherwise :) .
@anshumanf
Copy link

anshumanf commented Aug 11, 2016

In your diff, you should retain a generic free function that takes three parameters.

@WickyNilliams
Copy link

Like this, right?

free minQty freeQty item =
    if item.freeQty == 0 && item.qty >= minQty then
        { item | freeQty = freeQty }
    else
        item

I just noticed this issue, and came here to make a PR for the same reason :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants