果冻, 79 78 77 字节
-1修复错误:)(不应预先转置以找到索引,而应反向后转,但我们可以尾部而不是头部)
-1使用反射(⁽©ṅB+30_2¦2
-> ⁽0ṗb4+28m0
)
⁽0ṗb4+28m0SRṁRƲœiµṪȮ%30%20«4ị“nḄƲf⁷»s3¤Ṗ,ị“£ṢtẒ⁽ẹ½MḊxɲȧėAṅ ɓaṾ¥D¹ṀẏD8÷ṬØ»Ḳ¤$K
完整的程序可以打印结果
在线尝试!
怎么样?
稍后会更新...
⁽©ṅB+30_2¦2SRṁRƲZœiµḢȮ%30%20«4ị“nḄƲf⁷»s3¤Ṗ,ị“...»Ḳ¤$K - Main Link: integer, n
⁽©ṅB+30_2¦2SRṁRƲZœi - f(n) to get list of integers, [day, month]
⁽©ṅ - compressed literal 2741
B - to a list of binary digits -> [ 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1]
+30 - add thirty [31,30,31,30,31,30,31,31,30,31,30,31]
¦ - sparse application...
2 - ...to indices: [2]
_ 2 - ...action: subtract two [31,28,31,30,31,30,31,31,30,31,30,31]
Ʋ - last four links as a monad - i.e. f(x):
S - sum x 365
R - range [1..365]
R - range x (vectorises) [[1..31],[1..28],...]
ṁ - mould like [[1..31],[32..59],...]
Z - transpose [[1,32,...],[2,33,...],...]
œi - 1st multi-dimensional index of n -> [day, month]
µḢȮ%30%20«4ị“nḄƲf⁷»s3¤Ṗ,ị“...»Ḳ¤$K - given [day, month] format and print
µ - start a new monadic chain - i.e. f(x=[day, month])
Ḣ - head -- get the day leaving x as [month])
Ȯ - print it (with no newline) and yield it
%30 - modulo by thirty
%20 - modulo by twenty
«4 - minimum of that and four
¤ - nilad followed by link(s) as a nilad:
“nḄƲf⁷» - dictionary words "standard"+" the" = "standard the"
s3 - split into threes = ["sta","nda","rd ","the"]
ị - index into
Ṗ - remove rightmost character
¤ - nilad followed by link(s) as a nilad:
“...» - dictionary words "January"+" February"+...
Ḳ - split at spaces = ["January","February",...]
ị - index into (vectorises across [month])
, - pair e.g. ["th", ["February"]]
K - join with spaces ["th ", "February"]
- print (implicitly smashes) th February