Skip to content

[Concept Exercise] Cheese Club#517

Merged
colinleach merged 15 commits into
exercism:mainfrom
colinleach:cheese-club
Jun 11, 2026
Merged

[Concept Exercise] Cheese Club#517
colinleach merged 15 commits into
exercism:mainfrom
colinleach:cheese-club

Conversation

@colinleach

Copy link
Copy Markdown
Contributor

This is the best I've so far come up with for functional-programming. Adapted from Julia, I added name_customer() to practice map2(), and removed the make-a-matrix task (in the light of my skeptical comments in that Concept!).

Testing is quite light: probably enough, but let me know if you disagree.

The Introduction covers so much ground in overview format that I took the unusual step of leaving lots of links in. I don't think students can grapple with a sprawling library like purrr without looking at the docs, so links make it easier for them.

Once we agree an introduction.md here I'll copy it back to #501. A very central concept, literally - it should finally join up the concepts into a single connected tree (though with functions still missing).

@colinleach colinleach requested a review from depial June 11, 2026 19:25

@depial depial left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG2M!

I think testing is likely fine for the exercises.

I wish we could squeeze in some more functionality from the introduction. One thought for a task could be to ask for the differences between the ratings, as a sort of discrete derivative, to track customers' experiences between cheeses. This would encourage an accumulate(ratings, -)...

Nothing extravagant, just a thought.

Comment thread exercises/concept/cheese-club/.docs/instructions.md Outdated
Comment thread exercises/concept/cheese-club/.docs/introduction.md
Comment thread config.json Outdated
@colinleach

Copy link
Copy Markdown
Contributor Author

I wish we could squeeze in some more functionality from the introduction

Let's delay merging this while I think about it. Meanwhile, I'll copy the intro to the Concept, so we can merge that.

@depial

depial commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

If we stick with the current tasks, it seems like the section Reduce functions could be dropped from the Intro.

@colinleach

Copy link
Copy Markdown
Contributor Author

it seems like the section Reduce functions could be dropped from the Intro

I'll certainly leave it in the Concept intro. For the exercise, I'd rather use it in a task than drop it (details still TBD).

colinleach and others added 2 commits June 11, 2026 14:55
* [New Concept] Functional Programming

* Fix JSON formatting in config.json

* added clarifications

* typos

* copied intro from cheese-club

* Fix formatting issues in functional programming about.md
@colinleach

colinleach commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Using accumulate() proved harder than I thought. I cheated, and created a simple task with cummean() from dplyr.

The extra bit in introduction.md needs to be copied to the concept docs. I'll do that in this PR, if I can rebase without wrecking everything.

update: concept docs also changed.

@depial

depial commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Using accumulate() proved harder than I thought. I cheated, and created a simple task with cummean() from dplyr.

We could probably give a bit more in the hints.md to help this along.

Some ways I could think of solving it:

accumulate(ratings, `+`) |> map2_dbl(1:length(ratings), `/`)

cumsum(ratings) |> map2_dbl(1:length(ratings), `/`)

accumulate(ratings, `+`) / 1:length(ratings)

cumsum(ratings) / 1:length(ratings)

The first two seem to be most in line with what we're aiming at in this concept, but I'm not sure if you feel there's a good way to hint towards any of these.

EDIT: To complement your current hint, I suppose I couldn't hurt just to include another like:

  • This can be accomplished with an accumulate and a map2

Or something to that effect.

@colinleach

colinleach commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

I've added a few more lines to the hints. On the right track?

I think it can also be useful to post multiple approaches in our solution of this exercise, so they show up in Community Solutions.

@depial

depial commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

That seems good to me, the only other question that comes to mind is if we should explicitly mention map2_dbl or just leave it at map2. I'm ambivalent, so I'll let you decide what you think is best, and you can merge when you feel comfortable.

@colinleach colinleach merged commit 322d628 into exercism:main Jun 11, 2026
3 checks passed
Comment thread exercises/concept/cheese-club/.docs/instructions.md
@colinleach

Copy link
Copy Markdown
Contributor Author

The syllabus looks a lot nicer on the website not that it's all joined up into a connected tree.

I ran the solutions successfully, with a couple of approaches to task 5.

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.

2 participants