Skip to content

Instantly share code, notes, and snippets.

@msszczep
Last active May 7, 2016 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msszczep/5b55a9f87e8941d58a63e27a1a613e5b to your computer and use it in GitHub Desktop.
Save msszczep/5b55a9f87e8941d58a63e27a1a613e5b to your computer and use it in GitHub Desktop.
Dead or Not Dead (in Wolfram Language)
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