Last active
May 7, 2016 13:24
-
-
Save msszczep/5b55a9f87e8941d58a63e27a1a613e5b to your computer and use it in GitHub Desktop.
Dead or Not Dead (in Wolfram Language)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CloudDeploy[APIFunction[{"p" -> "String"}, DateString[Interpreter["Person"][#p]["DeathDate"], {"MonthName", " ", "DayShort", ", ", "Year"}] &]] | |
-- e.g., https://www.wolframcloud.com/objects/29dd4c7b-77f3-49ff-84be-fc557ddfc9a0?p=Michael+Jackson | |
-- https://www.wolframcloud.com/objects/fa2cf38e-b000-4762-b249-8d19bfaef1a0?p=Doris+Day | |
CloudDeploy[APIFunction[{"p" -> "String"}, Which[ | |
FailureQ[Interpreter["Person"][#p]], | |
"I'm sorry, but I cannot determine that.", | |
MissingQ[Interpreter["Person"][#p]["DeathDate"]], | |
StringJoin[#p, " is still alive, and is ", ToString[Floor[DateDifference[Interpreter["Person"][#p]["BirthDate"], Now, "Year"]]], " old." ], | |
True, | |
StringJoin[#p, " died on ", DateString[Interpreter["Person"][#p]["DeathDate"], {"MonthName", " ", "DayShort", ", ", "Year"}], "." ]] &], Permissions -> "Public"] | |
https://www.wolframcloud.com/objects/f700a840-75f0-4029-844d-64bfb7c6f0bd?p=Ruth+Bader+Ginsberg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment