Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #58172
| From | "Robert L." <No_spamming@noWhere_7073.org> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Rosetta: Find the last Sunday of each month |
| Date | 2017-04-26 06:28 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <odpell$fh4$1@gioia.aioe.org> (permalink) |
> Write a program or a script that returns the last Sundays of
> each month of a given year. The year may be given through any
> simple input method in your language (command line, std in,
> etc).
>
> Example of an expected output:
>
> ./last_sundays 2013
> 2013-01-27
> 2013-02-24
> 2013-03-31
> 2013-04-28
> 2013-05-26
> 2013-06-30
> 2013-07-28
> 2013-08-25
> 2013-09-29
> 2013-10-27
> 2013-11-24
> 2013-12-29
require 'date'
year = (ARGV[0]||2013).to_i
puts Date.new(year).upto(Date.new(year,12,31)).
select(&:sunday?).group_by(&:month).map{|_,v| v.last}
2013-01-27
2013-02-24
2013-03-31
2013-04-28
2013-05-26
2013-06-30
2013-07-28
2013-08-25
2013-09-29
2013-10-27
2013-11-24
2013-12-29
In Forth?
--
In his message [the Jew Nicolas] Sarkozy insisted that the French people must
change, that there will be dire consequences if they don't, and that not to
intermarry racially is bad for the survival of the country.
archive.org/download/DavidDuke_videos/StopTheGenocideOfEuropeanMankindDavidDuke-z43pcbr_el0.ogv
Back to comp.lang.forth | Previous | Next | Find similar | Unroll thread
Rosetta: Find the last Sunday of each month "Robert L." <No_spamming@noWhere_7073.org> - 2017-04-26 06:28 +0000
csiph-web