Created
September 1, 2018 10:41
-
-
Save blackawa/8ecca08549c67126b4cd7a3b31a45a12 to your computer and use it in GitHub Desktop.
雑な西暦->和暦変換関数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn- 西暦->和暦 [西暦] | |
(let [year (read-string 西暦)] | |
(cond | |
;; 平成 | |
(<= 0 (- year 1988)) | |
{:和暦 "平成" | |
:年 (- year 1988)} | |
;; 昭和 | |
(<= 0 (- year 1925)) | |
{:和暦 "昭和" | |
:年 (- year 1925)} | |
;; 大正 | |
(<= 0 (- year 1911)) | |
{:和暦 "大正" | |
:年 (- year 1911)} | |
:else | |
{:和暦 "不明" | |
:年 year}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment