I’m sorry
I read task 7
again and again
and I don’t exactly know, what to do here.
do the entries of intersection provide the category (VEGAN, VEGETARIAN, PALEO, KETO, or OMNIVORE),
and I have to check which category the given ingrediants are
or to subtract the set intersection from my result so far?
And:
As I can see there is a function symdiff(A, B)
But the hints tell me to bulid a symmetric difference by subtracting the set intersection from the set union,
and, “for more than two Sets - A symmetric difference is build by
subtracted intersections between all those set pairs needs from the symmetric difference.”
I would expect to subtracted the intersection from the unions …(that’s what I did)??
I’m totally lost
please help
thanks in advance
My Code:
function singleton_ingredients(dishes, intersection)
S_ed_u = S_ed_is = []
b_init = false
for s in example_dishes
if !b_init
# at first call S_ed_is (intersect) is empty so intersect would stay emtpy all the time !
S_ed_u = S_ed_is = s
b_init = true
else
S_ed_u = S_ed_u ∪ s
S_ed_is = S_ed_is ∩ s
end
end
# first try:
# s_sing_vegetarian = setdiff(S_ed_u ∪ VEGETARIAN_INTERSECTIONS, S_ed_is)
setdiff(S_ed_u, S_ed_is ∪ intersection)
end
Bethany has a day job (AFAIK) and a life outside of Exercism. She’s a volunteer who provides support in her spare time. Try to be patient with our volunteers!
It’s good to remember that sometimes hints are pointing you in one direction, and sometimes they offer several options. The latter is the case here.
Try not to overthink this and let’s try to see the bigger picture. With what you know in Julia this can be a one-liner (two functions plus a splat).
Each <CATEGORY>_INTERSECTIONS is a set of ingredients that appear in more than one dish in the category.
So you are given several dishes’ ingredients (<dishes>) and an intersection which tells you which ingredients appear in more than one dish (<INTERSECTIONS>).
You are expected to return the ingredients which only appear in one dish.
I’m sorry
I did’nt want to push anyone!
the situation was:
I posted a request similar to the on from yesterday two days back to no one specific - and no one answered.
So I thought, to write the request to her, so maybe she will get a direct
notification
The answer depial gave…
gave me the idea that it might be much more simple than I thought
and let me follow the aspect I already had yesterday:
what makes me feel/become so blocked inside that I cannot have a clear thought about the solution.
Maybe one aspect is that in my first or second class they tortured me with
“set theory” and I really didn’t get it…
thanks for your patience with me and for your kindness!
I’m glad that you were able to finish the exercise.
I think I should point out that my response had very little novel information in it (and possibly no novel information if you didn’t use splatting). That means that you could complete the exercise independently. It would be beneficial to reflect on how you were able to do that so you can repeat it in the future.
Being able to stand back and look at things afresh is an extremely valuable tool for independent learning, so I would suggest honing that skill at every opportunity.
Yes,
that’s what I did both.
And I’m also proud I could solve it myself.
the first thing that leadme into the wrong direction was,
that I read the explanations first paragraph and then in the second there was a cut.
I was astonished and felt an irritation …
but didn’t give that the neccessary attention.
The way _INTERSECTIONS was written also astouned me.
Question:
Can it be, the explanations have been changed in the meantime…?
because when I just looked there it said “CATEGORY_INTERSECTIONS” which wasn’t there before.
You are correct. This exercise was initially ported from the Python track with very little modification. They use different formatting conventions than we do, so we’ve recently updated the docs to make the formatting closer to other Julia exercises.