Feature request: add call pattern to (date-value)

Pondering the philosophy behind the language

Feature request: add call pattern to (date-value)

Postby TedWalther » Sun Apr 19, 2015 8:47 pm

It is true, I can do
Code: Select all
(apply date-value (now))


However, I have been working with Julian days for a while, and just generally doing date and time related stuff, and so I request that you add the call pattern:

Code: Select all
(date-value list)

Ex:
(date-value (now))


This is parallel to how arguments are dealt with in that
Code: Select all
format
function, so it makes sense from a "principle of least surprise" perspective.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
TedWalther
 
Posts: 603
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC

Re: Feature request: add call pattern to (date-value)

Postby Lutz » Mon Apr 20, 2015 6:51 am

Makes sense, added here:
http://www.newlisp.org/downloads/develo ... nprogress/

Code: Select all
> (date-value (date-list (date-value (date-list (date-value (now))))):-)
1429520236
>

http://www.newlisp.org/downloads/develo ... date-value
Lutz
 
Posts: 5259
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: Feature request: add call pattern to (date-value)

Postby TedWalther » Tue Apr 21, 2015 5:31 am

Thank you Lutz! And, I tremble to ask it. It is so easy to get the current date with (date-list (date-value))
But, for sake of consistency, would it slow anything down to let (date-list) do the same thing as (date-value) and (date)? That is, give the current time in the appropriate format?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
TedWalther
 
Posts: 603
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC

Re: Feature request: add call pattern to (date-value)

Postby Lutz » Tue Apr 21, 2015 9:50 am

... now it fits all together :)

Code: Select all
> (date-value) (date-value (date-list))
1429600114
1429600114
> (date-list) (date-list (date-value))
(2015 4 21 7 8 51 111 2)
(2015 4 21 7 8 51 111 2)
>


http://www.newlisp.org/downloads/develo ... nprogress/
Lutz
 
Posts: 5259
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: Feature request: add call pattern to (date-value)

Postby TedWalther » Tue Apr 21, 2015 5:07 pm

Woohoo! One of newLisps great strengths is its consistency of interface.
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
TedWalther
 
Posts: 603
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC


Return to Whither newLISP?

Who is online

Users browsing this forum: No registered users and 1 guest

cron