Jump to content

Chinese zodiac: Difference between revisions

m
Line 107:
"甲乙丙丁戊己庚辛壬癸" -- 天干 tiangan – heavenly stems
(words "jiă yĭ bĭng dīng wù jĭ gēng xīn rén gŭi")
 
ds :: [(String, String)]
ds =
Line 113:
(chars "子丑寅卯辰巳午未申酉戌亥") -- 地支 dizhi – terrestrial branches
(words "zĭ chŏu yín măo chén sì wŭ wèi shēn yŏu xū hài")
 
ws :: [(String, String, String)]
ws =
Line 120:
(words "mù huǒ tǔ jīn shuǐ")
(words "wood fire earth metal water")
 
xs :: [(String, String, String)]
xs =
Line 128:
(words "rat ox tiger rabbit dragon snake horse goat monkey rooster dog pig")
 
ys :: [(String, String)]
ys = zip (chars "阳阴") (words "yáng yīn") -- 阴阳 yinyang – dark & light
 
chars :: String -> [String]
chars = (flip (:) [] <$>)
 
-- TRADITIONAL CYCLES --------------------------------------------------------
f农历 y =
Line 147 ⟶ 148:
, [[], show (rem i年份 60 + 1) ++ " of 60", e五行, e生肖, []] -- en
]
 
-- FORMATTING ----------------------------------------------------------------
colWidths :: [[Int]]
colWidths = [[6, 10, 7, 8, 3], [6, 11, 8, 8, 4], [6, 11, 8, 8, 4]]
 
showRows :: Int -> String
showRows y =
Line 159 ⟶ 160:
where
justifyLeft n c s = take n (s ++ replicate n c)
 
-- TEST OUTPUT ---------------------------------------------------------------
main :: IO ()
9,659

edits

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