Saturday, May 2, 2020

Re: Use Vim to compute the date of Easter

-----Original Message-----
From: Tony Mechelynck
Sent: Saturday, May 02, 2020 6:29 PM
To: vim_use
Subject: Use Vim to compute the date of Easter

Ever wondered when Easter would happen? Now Vim (version 7 or later)
can tell you. I know it's the wrong season, but I found an algorithm
on Wikipedia (from an anonymous author, dated 1876, and itself
elaborating on an algorithm by Gauss) and decided it would be easy to
program that in Vim script.

So I wrote a little autoload script, tried it, and when it gave
obviously wrong answers I finally found out (not easily) that I had
forgotten a pair of parentheses. Now it does what I want:
easter#date(year), where year is a year number, returns a Dictionary
which is either empty (if the input was invalid; in that case it also
produces a nasty :msgerr to tell you what error was found) or else
contains the keys 'year', 'month' and 'day' with an integer value for
each of them: https://www.vim.org/scripts/script.php?script_id=5878

Known limitation: the input must be an integer (or a String or Float
which will be converted to an Integer) > 1582, and only _Gregorian_
Easter dates are produced. If you want to compute Julian (Orthodox)
Easter, or Pesach, or the Chinese New Year, or something else, go
ahead and write them: they are not the purpose of this script, which
"does one thing, does it predictably, and doesn't try to do a lot of
other things on the side".

Have fun!
Tony.

Hi Tony

I'm not sure where you're based. You realise, I expect, that England (and I
think the USA) didn't change to the Gregorian calendar until 1752. I'm not
sure whether all western Europe celebrated Easter on the same day despite
the different dates in the interim. It wd appear not.

regards - Chris

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/AA8341F35AA1408EB163AE2C54C81480%40ChrisPCW7.

No comments:

Post a Comment