A really stupid question
A really stupid question
Hi all,
I'm new on the forum as well as new to lisp.
I got into lisp because that's what the AI platform I'm playing with is coded in and hey, I like it so far but have come across a few things I just don't understand and yes, believe me, I know this question is stupid but I just can't figure it out..
Ok, so I need to write a function to get tomorrows date to pass along to an external binary that I'll be writing in C, nothing big or fancy.
I found a package (I think it's called) that has this function, namely cl-date-calc over on http://www.cliki.net/Date-Calc
My gripe is.. how do I get it to work? From what I understand it's suppose to be a port, so standalone, but I can't figure out how to go about getting it to work.. Yes, yes I'm aware how "noobish" it is to not be able to get a basic thing like this to work, in my defense I've got no training in Lisp, no experience, and threw myself in head first. lol.
So, uh, anyone feel like helping a newbie who's feeling kind of sheepish.. :/
I'm new on the forum as well as new to lisp.
I got into lisp because that's what the AI platform I'm playing with is coded in and hey, I like it so far but have come across a few things I just don't understand and yes, believe me, I know this question is stupid but I just can't figure it out..
Ok, so I need to write a function to get tomorrows date to pass along to an external binary that I'll be writing in C, nothing big or fancy.
I found a package (I think it's called) that has this function, namely cl-date-calc over on http://www.cliki.net/Date-Calc
My gripe is.. how do I get it to work? From what I understand it's suppose to be a port, so standalone, but I can't figure out how to go about getting it to work.. Yes, yes I'm aware how "noobish" it is to not be able to get a basic thing like this to work, in my defense I've got no training in Lisp, no experience, and threw myself in head first. lol.
So, uh, anyone feel like helping a newbie who's feeling kind of sheepish.. :/
Re: A really stupid question
Lisp a large family of highly divergent languages, with Common Lisp being one of those languages. The first question here that must be asked, are you sure your platform is written in Common Lisp, and not some other Lisp dialect? What is this platform, anyway?Trenatos wrote:I got into lisp because that's what the AI platform I'm playing with is coded in and hey,
I believe that the best currently supported system for this is local-time.Trenatos wrote:Ok, so I need to write a function to get tomorrows date
What exactly do you mean? Does the system not work, or can you not install it? Normally you would use something like clbuild to install libraries and asdf to load them.Trenatos wrote:but I can't figure out how to go about getting it to work
Re: A really stupid question
Hi Ramarren,
I'm using Lispworks Personal Edition. Most of the AI platform is written in CL though I believe there are som Lispworks proprietary functions in it.
I think I would need a walk-through of how to install and load something like drakma, cl-date, or so, so that I have something to go on, something to give me an idea of how to go about it.
local-time? That would give me an accurate date for tomorrow, regardless of if tomorrow is the 1st, new year, etc.? Same thing though, I need help or a small walkthrough of how to get it installed and up to the point where I can call it an a source file..
/Marcus
I'm using Lispworks Personal Edition. Most of the AI platform is written in CL though I believe there are som Lispworks proprietary functions in it.
I think I would need a walk-through of how to install and load something like drakma, cl-date, or so, so that I have something to go on, something to give me an idea of how to go about it.
local-time? That would give me an accurate date for tomorrow, regardless of if tomorrow is the 1st, new year, etc.? Same thing though, I need help or a small walkthrough of how to get it installed and up to the point where I can call it an a source file..
/Marcus
Re: A really stupid question
The operating system makes a difference. Windows is generally more poorly supported by open-source CL community, which makes installing things trickier. I am also not sure from your post how well you understand how CL works. Have you read a book like Practical Common Lisp? Understanding the image-based incremental nature of CL is critical to understanding how systems work.
Installing a CL library just means downloading it and putting it somewhere. Due to general lack of release culture it is often a good idea to use an appropriate version control system to obtain the current version. This can be automated using clbuild, but that solution is fairly Linux-centric.
The most common tool for building and loading system is ASDF. It has a manual.
Installing a CL library just means downloading it and putting it somewhere. Due to general lack of release culture it is often a good idea to use an appropriate version control system to obtain the current version. This can be automated using clbuild, but that solution is fairly Linux-centric.
The most common tool for building and loading system is ASDF. It has a manual.
Now that I think about it you don't really need a library for that. You can use GET-UNIVERSAL-TIME to obtain current time in seconds, add to it (* 24 60 60) seconds and obtain the date using DECODE-UNIVERSAL-TIME. Time calculations are somewhat tricky, and there are cases where this might be wrong for some definitions of "tomorrow" (daylight saving times, maybe?), so it is probably best to use something like local-time, anyway.Trenatos wrote:That would give me an accurate date for tomorrow, regardless of if tomorrow is the 1st, new year, etc.?
Re: A really stupid question
Maybe you should take a look at:
-> http://en.wikibooks.org/wiki/Common_Lisp/Advanced_topics/Dates_and_Times
-> http://cl-cookbook.sourceforge.net/dates_and_times.html
This is the way to compute times and dates with standard build-in Common Lisp functions, no loading of libraries required.
Should work with every Common Lisp implementation on every OS.
-> http://en.wikibooks.org/wiki/Common_Lisp/Advanced_topics/Dates_and_Times
-> http://cl-cookbook.sourceforge.net/dates_and_times.html
This is the way to compute times and dates with standard build-in Common Lisp functions, no loading of libraries required.
Should work with every Common Lisp implementation on every OS.
Re: A really stupid question
Thanks guys, any help is appreciated.
I'm on a Windows XP platform and as I said before I have no experience nor training in CL, I've been teaching myself on the web and through looking at source code for the AI and things are going forward, and example would be that I've used lisp to add voice commands, responses, etc. for the AI platform.
I'm right now waiting on a book on Lisp that I ordered on Amazon.
I'm not at home so I can't try anything right now but read things I can, I'm also going to need networking so I have looked at trivial-http and Drakma (For a more complete setup) same thing though, how do I go about getting it installed and setup so that I can use it? From start to finish that is..
I'm on a Windows XP platform and as I said before I have no experience nor training in CL, I've been teaching myself on the web and through looking at source code for the AI and things are going forward, and example would be that I've used lisp to add voice commands, responses, etc. for the AI platform.
I'm right now waiting on a book on Lisp that I ordered on Amazon.
I'm not at home so I can't try anything right now but read things I can, I'm also going to need networking so I have looked at trivial-http and Drakma (For a more complete setup) same thing though, how do I go about getting it installed and setup so that I can use it? From start to finish that is..