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.
--
--
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/CAJkCKXuSGy%2BtbhuvM3C5XszYLTXv1q%3DeZ%3DB60-Vp4pGK3nDNxQ%40mail.gmail.com.
No comments:
Post a Comment