Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

REBOL Documentation Project and Minor Bug report

 [1/3] from: al:bri:xtra at: 27-Sep-2001 15:58


Paul asked:
> Ok. Information Request - Trying to give a summary of these sections of
the system object:
> /locale >> probe rebol/locale
make object! [ months: [ "January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December" ] days: [ "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" Sunday ] ] /locale is an object! that contains locale-specific names for the months of the year ('month), and the days in each week ('days). The index of each name is exactly the same as the number returned by the appropriate refinement on date! values. For example:
>> now/date ; It's a Thursday.
== 27-Sep-2001
>> now/month
== 9
>> rebol/locale/months/9
== "September"
>> now/weekday
== 4
>> rebol/locale/days/4
== "Thursday" Note that this points out a name problem with /locale -- the word 'days in the /locale object should really be 'weekdays, so as to match with the refinement /weekday for date! values. 'probe rebol/locale should return: make object! [ months: [ "January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December" ] weekdays: [ "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" Sunday ] ] where 'days has been replaced with 'weekdays. I've reported this to [feedback--rebol--com]. A suitable patch is: rebol/locale: make object! [ months: rebol/locale/months weekdays: rebol/locale/days ] Just place the above in %User.r. I hope that helps! Andrew Martin ICQ: 26227169 http://zen.scripterz.org

 [2/3] from: al::bri::xtra::co::nz at: 27-Sep-2001 18:45


/locale Which then leads one to design some month and weekday functions which are locale specific: use [Months Index] [ Months: system/locale/months forall Months [ Index: index? Months system/locale/months do reduce [ to set-word! join first Months "?" 'func [ "Is Date this month?" Date [date!] ] reduce ['= Index 'Date/Month] ] ] ] Month: func [Date [date!]][ pick system/locale/months Date/month ] use [Weekdays Index] [ Weekdays: system/locale/weekdays forall Weekdays [ Index: index? Weekdays system/locale/weekdays do reduce [ to set-word! join first Weekdays "?" 'func [ "Is Date this weekday?" Date [date!] ] reduce ['= Index 'Date/weekday] ] ] ] Weekday: func [Date [date!]][ pick system/locale/weekdays Date/weekday ] and allow these kind of results:
>> now
== 27-Sep-2001/18:43:41+12:00
>> september? now
== true
>> month now
== "September"
>> thursday? now
== true
>> weekday now
== "Thursday" Andrew Martin ICQ: 26227169 http://zen.scripterz.org

 [3/3] from: ptretter:charter at: 27-Sep-2001 6:28


Excellent Andrew. I'm gonna add your contributions to the Project. Paul Tretter ----- Original Message ----- From: "Andrew Martin" <[Al--Bri--xtra--co--nz]> To: <[rebol-list--rebol--com]> Cc: <[feedback--rebol--com]>