Jump to content

Five weekends: Difference between revisions

m
→‎Haskell Using Data.Time: (simpler harvest of last five matches)
(→‎Haskell – Using Data.Time: Adjusted a couple of names for easier reading)
m (→‎Haskell Using Data.Time: (simpler harvest of last five matches))
Line 2,986:
import Data.List.Split (chunksOf)
import Data.List (intercalate)
 
 
-- MONTHS WITH FIVE WEEKENDS --------------------------------------------------
Line 3,000 ⟶ 2,999:
let (_, _, day) = toWeekDate d
in day == 5
 
-- TEST -----------------------------------------------------------------------
Line 3,015 ⟶ 3,013:
xs
years
n = (length . concat) xs
(putStrLn . intercalate "\n\n")
[ "How many five-weekend months 1900-2100 ?"
, '\t' : show (length . concat $ xs)n
, "First five ?"
, '\t' : show (concat (take 5 xs))
, "Last five ?"
, '\t' : show (concat (reversedrop .(n concat) (take- 5 (reverse) xs)))
, "How many lean years ? (No five-weekend months)"
, '\t' : show (length lean)
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.