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

[REBOL] optimization?

From: kpeters:otaksoft at: 26-Sep-2007 21:17

I have a strong feeling that my code below can be significantly shortened and optimized - any suggestions? TIA, Kai Create a block containing the days of the week for an entire month based on a given date. Disregard the missing leapyear handling - none of us will be around to see it screw up! Input: 2007-02-14 Output: [ "Thu" "Fri" ...... ] curdate: 2007-02-14 ; days-per-month: [ 31 28 31 30 31 31 30 31 30 31 ] weekdays: [ "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun" ] m: curdate/month maxday: days-per-month/:m days: copy [] for day 1 maxday 1 [ tdate: to-date rejoin [ curdate/year "-" curdate/month "-" day ] wd: tdate/weekday wd: weekdays/:wd append days wd ] probe days