* new calendrical calculations - elisp - common lisp
@ 2011-06-13 16:40 Benjamin Slade
[not found] ` <4DF64086.20802@cs.ucla.edu>
2011-06-13 17:06 ` Edward Reingold
0 siblings, 2 replies; 6+ messages in thread
From: Benjamin Slade @ 2011-06-13 16:40 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2254 bytes --]
I would like to add a "module" to Emacs for converting from Gregorian dates
into traditional Indian/Hindu dates (Bikrama Samvat), and, perhaps more
importantly, for calculating Hindu holidays.
I found a very nice set of functions for doing so implemented in Common Lisp
in *Deshow, Nachum and Reingold, Edward M. 2008. _Calendrical Calculations_.
New York: Cambridge University Press, 3rd edn*. I was wondering if this
perhaps has already been implemented (given that Reingold developed the
original calendar calculations for Emacs).
If not: What is the best way of using this code in Emacs? I know that Emacs
Lisp is different from Common Lisp - and I also know that there is/are
package(s?) for using Common Lisp within Emacs.
What I don't know is:
(1) Can this code just be converted into Emacs Lisp? Or are there bits of it
which would require Common Lisp?
[Right now it doesn't work - I know that Emacs Lisp requires "defconst"
rather than "defconstant", but even changing that, I get a "condition-case:
Symbol's value as variable is void: 279457/1080000" error for:
(defconst hindu-sidereal-year
;; TYPE rational
;; Mean length of Hindu sidereal year.
(+ 365 279457/1080000))
And changing the definition to (+ 365 (/ 1080000 279457)) it seems just to
round.]
(2) Or else, if it is necessary, how to use Common Lisp packages in Emacs.
I have transcribed the code here:
http://www.jnanam.net/emacs/hindu-calendar.el [there are probably typos in
it yet].
I'm, obviously, not really a Lisp coder, but I am looking for some pointers
for how to get this code working within Emacs.
thanks,
--Ben
-----------------------------------------------------------------------------------------------------
Benjamin Slade
Dept. of Linguistics
University of Illinois at Urbana-Champaign
[ http://www.jnanam.net/slade/ ]
Stæfcræft & Vyākaraṇa (lingblog) - http://staefcraeft.blogspot.com
The Babbage Files (techblog) - http://babbagefiles.blogspot.com
-----------------------------------------------------------------------------------------------------
*प*रो ऽक्ष॑का*मा* हि *दे*वाः
'The gods love the obscure.' (Śatapathabrāmaṇa 6.1.1.2)
[-- Attachment #2: Type: text/html, Size: 2811 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <4DF64086.20802@cs.ucla.edu>]
* Re: new calendrical calculations - elisp - common lisp
[not found] ` <4DF64086.20802@cs.ucla.edu>
@ 2011-06-13 17:00 ` Benjamin Slade
2011-06-13 19:28 ` Paul Eggert
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Slade @ 2011-06-13 17:00 UTC (permalink / raw)
To: Paul Eggert; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2193 bytes --]
Thanks, Paul. I wrote to Ed Reingold a few days ago asking him about this
issue, but I haven't heard back from him.
A general question: do you have any sense for whether these sorts of
calculations could be handled by Emacs Lisp, or whether they require Common
Lisp?
I would be interested in coding this up from scratch in the event that the
Deshow/Reingold functions can't be incorporated directly, though given my
very rudimentary understanding of Lisp (both Emacs and Common), I imagine
this would take some time (#damnitjimimalinguistnotalispcoder).
cheers,
--Ben
On 13 June 2011 11:53, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 06/13/11 09:40, Benjamin Slade wrote:
> > I found a very nice set of functions for doing so implemented in Common
> Lisp
> > in *Deshow, Nachum and Reingold, Edward M. 2008. _Calendrical
> Calculations_.
> > New York: Cambridge University Press, 3rd edn*. I was wondering if this
> > perhaps has already been implemented (given that Reingold developed the
> > original calendar calculations for Emacs).
>
> I expect the answer is that it hasn't been. And we can't simply
> incorporate
> the copyrighted code from the book into Emacs without having copyright
> permission
> from the authors. However, if you could code the ideas up from scratch,
> without
> copying the book's code, that would be a nice addition to Emacs. Another
> possibility
> is that you could contact Ed Reingold and ask him whether he'd be willing
> to
> donate the code; perhaps if enough people ask, he'll change his mind.
>
--
-----------------------------------------------------------------------------------------------------
Benjamin Slade
Dept. of Linguistics
University of Illinois at Urbana-Champaign
[ http://www.jnanam.net/slade/ ]
Stæfcræft & Vyākaraṇa (lingblog) - http://staefcraeft.blogspot.com
The Babbage Files (techblog) - http://babbagefiles.blogspot.com
-----------------------------------------------------------------------------------------------------
*प*रो ऽक्ष॑का*मा* हि *दे*वाः
'The gods love the obscure.' (Śatapathabrāmaṇa 6.1.1.2)
[-- Attachment #2: Type: text/html, Size: 2862 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: new calendrical calculations - elisp - common lisp
2011-06-13 17:00 ` Benjamin Slade
@ 2011-06-13 19:28 ` Paul Eggert
0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggert @ 2011-06-13 19:28 UTC (permalink / raw)
To: Benjamin Slade; +Cc: emacs-devel
On 06/13/11 10:00, Benjamin Slade wrote:
> A general question: do you have any sense for whether these sorts of
> calculations could be handled by Emacs Lisp, or whether they require Common
> Lisp?
I'm sure Emacs Lisp is up to doing them. There may be some issues with
large integers but they can be handled. As you suspect, though, it
will take a bit of hacking to do it right.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: new calendrical calculations - elisp - common lisp
2011-06-13 16:40 new calendrical calculations - elisp - common lisp Benjamin Slade
[not found] ` <4DF64086.20802@cs.ucla.edu>
@ 2011-06-13 17:06 ` Edward Reingold
2011-06-13 19:59 ` Richard Stallman
1 sibling, 1 reply; 6+ messages in thread
From: Edward Reingold @ 2011-06-13 17:06 UTC (permalink / raw)
To: Benjamin Slade; +Cc: emacs-devel
Sorry, the code in our book is NOT in the public domain and cannot be
used in Emacs.
On Mon, Jun 13, 2011 at 11:40 AM, Benjamin Slade <slade@jnanam.net> wrote:
> I would like to add a "module" to Emacs for converting from Gregorian dates
> into traditional Indian/Hindu dates (Bikrama Samvat), and, perhaps more
> importantly, for calculating Hindu holidays.
>
> I found a very nice set of functions for doing so implemented in Common Lisp
> in *Deshow, Nachum and Reingold, Edward M. 2008. _Calendrical Calculations_.
> New York: Cambridge University Press, 3rd edn*. I was wondering if this
> perhaps has already been implemented (given that Reingold developed the
> original calendar calculations for Emacs).
>
> If not: What is the best way of using this code in Emacs? I know that Emacs
> Lisp is different from Common Lisp - and I also know that there is/are
> package(s?) for using Common Lisp within Emacs.
>
> What I don't know is:
> (1) Can this code just be converted into Emacs Lisp? Or are there bits of it
> which would require Common Lisp?
>
> [Right now it doesn't work - I know that Emacs Lisp requires "defconst"
> rather than "defconstant", but even changing that, I get a "condition-case:
> Symbol's value as variable is void: 279457/1080000" error for:
>
> (defconst hindu-sidereal-year
> ;; TYPE rational
> ;; Mean length of Hindu sidereal year.
> (+ 365 279457/1080000))
>
> And changing the definition to (+ 365 (/ 1080000 279457)) it seems just to
> round.]
>
> (2) Or else, if it is necessary, how to use Common Lisp packages in Emacs.
>
> I have transcribed the code here:
> http://www.jnanam.net/emacs/hindu-calendar.el [there are probably typos in
> it yet].
>
> I'm, obviously, not really a Lisp coder, but I am looking for some pointers
> for how to get this code working within Emacs.
>
> thanks,
> --Ben
> -----------------------------------------------------------------------------------------------------
> Benjamin Slade
> Dept. of Linguistics
> University of Illinois at Urbana-Champaign
> [ http://www.jnanam.net/slade/ ]
>
> Stæfcræft & Vyākaraṇa (lingblog) - http://staefcraeft.blogspot.com
> The Babbage Files (techblog) - http://babbagefiles.blogspot.com
>
> -----------------------------------------------------------------------------------------------------
> परो ऽक्ष॑कामा हि देवाः
> 'The gods love the obscure.' (Śatapathabrāmaṇa 6.1.1.2)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-06-17 20:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-13 16:40 new calendrical calculations - elisp - common lisp Benjamin Slade
[not found] ` <4DF64086.20802@cs.ucla.edu>
2011-06-13 17:00 ` Benjamin Slade
2011-06-13 19:28 ` Paul Eggert
2011-06-13 17:06 ` Edward Reingold
2011-06-13 19:59 ` Richard Stallman
2011-06-17 20:34 ` Chong Yidong
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).