Cheryl's birthday: Difference between revisions

Content added Content deleted
(=={{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: Line 178:


// The month with only one remaining day,
// The month with only one remaining day,

// (A's month contains only one remaining day)
// (A: "Then I also know")
monthsWithSingleDays(true)(
monthsWithSingleDays(true)(


// among the days with unique months,
// among the days with unique months,

// (B's day is paired with only one remaining month)
// (B: "I know now")
daysWithUniqueMonths(true)(
daysWithUniqueMonths(true)(


// excluding months with unique days,
// 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)(
monthsWithUniqueDays(false)(


// from the given month-day pairs:
// from the given month-day pairs:

// (Cheryl's list)
map(x => tupleFromList(words(strip(x))),
map(x => tupleFromList(words(strip(x))),
splitOn(/,\s+/,
splitOn(/,\s+/,