Group Abstract Group Abstract

Message Boards Message Boards

[GOLF] Code-Golfing websites: How old are you on another planet?

POSTED BY: Vitaliy Kaurov
9 Replies

Could you please explain the syntax of the URLShorten function that appends the shortened URL with a custom word "howoldplanet" ?

POSTED BY: Manjunath Babu
POSTED BY: Vitaliy Kaurov

Yes, I tried executing the following command but it did not produce correct output.

URLShorten["http://blog.stephenwolfram.com/2016/10/computational-law-symbolic-discourse-and-the-ai-constitution", "LeibnizsDreamAI"]

But, Thanks for letting me know that its available only for special accounts.

POSTED BY: Manjunath Babu

Code-Golfing Tweet-a-Program: Martin Luther King's age in years and days on other planets if he was living on them! :-)

AssociationThread[{"yr","days"}->(Now-=[King bday])/#]&/@Dataset[PlanetData[All,{"OrbitPeriod","SolarDay"},"EntityAssociation"]]

Martin Luther King age on other planets

Interestingly, Martin Luther King would be 364 years old on Mercury but only 182 days old since one solar day on Mercury lasts about as long as 176 days on Earth!

POSTED BY: Bernat Espigulé
Posted 9 years ago

I'm not the golfing sort, but this is still pretty short:

Dataset[(Now - DateObject[{1961, 8, 4}])/# & /@ 
    PlanetData[PlanetData[], "OrbitPeriod", "EntityAssociation"]]

enter image description here

POSTED BY: J. M.

A very nice try. With my counter it gave exactly 100 characters:

enter image description here

POSTED BY: Vitaliy Kaurov

And actually we do not need pure function there and Map, devision is listable:

Dataset[(Now - DateObject[{1961, 8, 4}])/PlanetData[PlanetData[], "OrbitPeriod", "EntityAssociation"]]
POSTED BY: Vitaliy Kaurov

Very impressive code! thanks for sharing. I can only make it one character smaller:

Grid[{(f=PlanetData)[],(Now-DateObject@{1961,8,4})/f[f[],"OrbitPeriod"]}]

by using the @ rather than []...

POSTED BY: Sander Huisman

Thanks, @Sander! I just realized I could easily turn it into tutorial on making microsites. I added some stuff to the post. I hope more folks will be adopting cloud interfaces.

POSTED BY: Vitaliy Kaurov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard