Calendar for Factor 080
Update release for of calendar Factor 080
As usual, probably buggy, so use it at your own risk
Update release for of calendar Factor 080
As usual, probably buggy, so use it at your own risk
Aligned with last release of Factor 079 (unit test probably not updated but all rest work)
This release of Factor (079) provide a lot of change and the new UI doesn’t work on my Linux Mandriva
(give an Out Of Memory error probably related to [ SDL_GL_SwapBuffers ]
)
I have also try this release on Windows 2000 - work fine even the UI
not tested deeply but this release should work for both 2 two datas types calendar and date. Please use it and send me bugs report
You may send comment to : nodrygo at free dot fr
Very few modifications - code cleaning
Start of some code cleaning and a major change for name
WHY :
Main differences with dates and calendar are:
Many changes according Slava suggestions that simplify the code by a lot
WARNING this release doesn’t work with date < 01/01/1970
this is a major bug. Next release should resolve this issue (I hope).
There is still some parts to simplify and finish.
This code si NOT WELL TESTED and it may containt bugs !!!
{ %D “/” %M “/” %Y ” ” %h “:” %m “:” %s } datefmt .
Give “25/07/2005 16:12:18″
- Now all the fiels are computed on demand. Hope this is fast enougth.
- Now I have set by default
2 “timezone” set ! default GMT + 2
“fr” “locales” set ! defaut locales france
not sure it is bug free
calendar03.zip
Exemple of use
“25/7/2005 16:12:18″ parse-fmt-fr .s
<< calendar [ ] 1122307938000 12989 58338 2005 206 7 25 16 12 18 "fr" 0 "fr" >>
calendar>string .
“25/7/2005 16:12″
Of course you need to write your own parser using parse-fmt-fr as exemple
Now I am stopping for few time on calendar , trying another things on Factor
Following slava comments, some simplifications
Still the same request on TUPLE
How to remove some mutator field: >> :private thing ?
calendar0.2.zip
Exemple of use
new-calendar
dup calendar>string .
“20/7/2005 7:47″
dup “fr-full” swap set-calendar-locale
dup calendar>string .
“Mercredi 20/7/2005 7:47:49 GMT:0″
dup 2 set-timezone
dup calendar>string .
“20/7/2005 9:47″
warning still probably buggy
The better way to learn new language is writing code so I do it.
This is the premices of a dates/calendar lib.
Actually it is not finished yet, but some part seem to work. It is not tested at all, so, probably buggy.
I am not sure the code is the clever one because I am still not confident with Factor and also because I am pragmatic … if it works fine … let’s go … I leave the subjective beauty of the code for purist.
Uncompress this CALENDAR in Factor/library and go
COMMENT and QUERY
The <calendar> is immutable ( except the fact TUPLE is not immutable .. I have to learn deeper this)
- The millisec field is ALWAYS express in GMT 0.
- Other fields are the externals representation of the date according the timelag
- settimezone create new calendar with same millisec but different representation (don’t know if it is a good idea)
I wonder if TUPLE should not have something like :R or :RW modifyer to change the built of the words associated
( :R doesn’t create mutator for field while :RW does and default :R)
I hope I’ll finish calendar soon
Factor is a new programming language from Slava Pestov combining some forth, lisp and joy concepts in a great portable environment. Very good key features and a lot of good ideas .. I really like it.
But unfortunatly it is a bit too young to be really usable and there is still some important lack. Some reflexions on this below
My ultimate dream: Factor runing on MAEMO with ARM back end compiler. I plan to buy the NOKIA 770 by the end of this year and I really like to use it for Factor coding pending my long (3H) daily transport in the train to go to work. Factor need few sign for write code so it should be possible even with the tactile keyboard.
I also wonder if Factor permit easilly to write some WORD code using a direct virtual assembly level. I have not closely look a VOP and the doc seem limitated in this area, but it should be great to look closer.
Réalisé avec WordPress visitors