June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
17
Task/Five-weekends/Factor/five-weekends.factor
Normal file
17
Task/Five-weekends/Factor/five-weekends.factor
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
USING: calendar calendar.format formatting fry io kernel math
|
||||
sequences ;
|
||||
IN: rosetta-code.five-weekends
|
||||
|
||||
: timestamps>my ( months -- )
|
||||
[ { MONTH bl YYYY nl } formatted 2drop ] each ;
|
||||
|
||||
: month-range ( start-year #months -- seq )
|
||||
'[ _ <year> _ <iota> ] call [ months time+ ] with map ;
|
||||
|
||||
: find-five-weekend-months ( months -- months' )
|
||||
[ [ friday? ] [ days-in-month ] bi 31 = and ] filter ;
|
||||
|
||||
1900 12 201 * month-range find-five-weekend-months
|
||||
[ length "%d five-weekend months found.\n" printf ]
|
||||
[ 5 head timestamps>my "..." print ]
|
||||
[ 5 tail* timestamps>my ] tri
|
||||
Loading…
Add table
Add a link
Reference in a new issue