Cheryl's birthday: Difference between revisions
→{{header|JavaScript}}: Mapped comments to stages of problem. (from core of function-nest outwards)
(=={{header|JavaScript}}== Added a first JS draft, aiming for some degree of legibility) |
(→{{header|JavaScript}}: Mapped comments to stages of problem. (from core of function-nest outwards)) |
||
Line 178:
// The month with only one remaining day,
// (A's month contains only one remaining day)
// (A: "Then I also know")
monthsWithSingleDays(true)(
// among the days with unique months,
// (B's day is paired with only one remaining month)
// (B: "I know now")
daysWithUniqueMonths(true)(
// excluding months with unique days,
// (A's month is not among those with unique days)
// (A: "I know that Bernard does not know")
monthsWithUniqueDays(false)(
// from the given month-day pairs:
// (Cheryl's list)
map(x => tupleFromList(words(strip(x))),
splitOn(/,\s+/,
|