Paste: a few time-related utils
Author: | randy7 |
Mode: | factor |
Date: | Thu, 26 Mar 2009 09:56:49 |
Plain Text |
: +gt+?
<=> +gt+ eq? ;
: time-before?
now time- second>> 0 < ;
: max-neg
2array [ 0 < ] filter
dup empty? [ "dude, they're both non-negative numbers" throw ] when
[ <=> ] sort peek ;
: time-max-neg
2array [ time-before? ] filter
dup empty? [ "dude, they're both in the future! WHOA" throw ] when
[ <=> ] sort peek ;
: last-weekday
[ now now [ 7 - ] change-day ] dip [ day-this-week ] curry bi@ time-max-neg ;
: closest-past-weekdays
6 [0,b] [ last-weekday ] map ;
Author: | randy7 |
Mode: | factor |
Date: | Wed, 8 Apr 2009 11:03:28 |
Plain Text |
: last-sunday 0 last-weekday ; inline
: last-monday 1 last-weekday ; inline
: last-tuesday 2 last-weekday ; inline
: last-wednesday 3 last-weekday ; inline
: last-thursday 4 last-weekday ; inline
: last-friday 5 last-weekday ; inline
: last-saturday 6 last-weekday ; inline
New Annotation