Cheryl's birthday: Difference between revisions

Content deleted Content added
Hout (talk | contribs)
→‎Functional Python: Applied pylint for Python 3, removing functionally extraneous additions which caused both pylint and mypy errors.
Wherrera (talk | contribs)
add Julia example
Line 1,179: Line 1,179:
{{Out}}
{{Out}}
<pre>[["July","16"]]</pre>
<pre>[["July","16"]]</pre>


=={{header|Julia}}==
<lang julia>const dates = [[15, "May"], [16, "May"], [19, "May"], [17, "June"], [18, "June"],
[14, "July"], [16, "July"], [14, "August"], [15, "August"], [17, "August"]]

uniqueday(parr) = filter(x -> sum(y -> y[1] == x[1], parr) == 1, parr)

f1 = filter(m -> !(m[2] in [d[2] for d in uniqueday(dates)]), dates)
bday = uniqueday(f1)[1]
println("Cheryl's birthday is $(bday[2]) $(bday[1]).")
</lang>{{out}}
<pre>
Cheryl's birthday is July 16.
</pre>


=={{header|Kotlin}}==
=={{header|Kotlin}}==