--NoDr - YGO--

7/18/2005

Factor first lines of code

Classé dans: — @ 9:56 pm

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

  • TEST
    new-calendar .s  (word for today <calendar> )
    << calendar [ ] 1121715062216 12982 70262 2005 199 7 18 19 31 2 “fr” 0 “fr” >>
    dup print-fmt .
    “18/7/2005 19:31″
    dup 2 swap settimezone
    dup print-fmt-fr-full .
    “Lundi 18/7/2005 21:31:2 GMT:2″

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)

  • DATES
    primitives for dates computations
  • CALENDAR
    calendar classes
  • LOCALES
    printer and parser (not yet done) for differents locales

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

Database error: [Table 'yvan_godin.wp_comments' doesn't exist]
SELECT * FROM wp_comments WHERE comment_post_ID = '5' AND comment_approved = '1' ORDER BY comment_date

Commentaires

Pas encore de commentaire

Flux RSS pour les commentaires sur cet article.

Poster un commentaire

Désolé, le formulaire de commentaire est fermé pour le moment.

Réalisé avec WordPress  visitors