TṀị
“¢<<ð¢‘×\×€0¦7,31,365F⁸:µç“ɲþḣ⁹ḢṡṾDU¤µQƝṁ⁼ẹ»Ḳ¤ṭÇK;⁸Ç>1¤¡”s
결과를 인쇄하는 전체 프로그램.
(모나 딕 링크로서 정수와 문자의 목록을 반환합니다)
온라인으로 사용해보십시오!
방법?
TṀị - Link 1: list of integers, K; list, V e.g. [86401,1440,24,1,0,0,0], ["second","minute","hour","day","week","month","year"]
T - truthy indexes of K [1,2,3,4]
Ṁ - maximum 4
ị - index into V "day"
“¢<<ð¢‘×\×€0¦7,31,365F⁸:µç“...»Ḳ¤ṭÇK;⁸Ç>1¤¡”s - Main link: integer, N e.g. 3599
“¢<<𢑠- list of code-page indices = [1,60,60,24,1]
\ - cumulative reduce with:
× - multiplication = [1,60,3600,86400,86400]
7,31,365 - list of integers = [7,31,365]
¦ - sparse application...
0 - ...to index: 0 (rightmost)
×€ - ...of: multiplication for €ach = [1,60,3600,86400,[604800,2678400,31536000]]
F - flatten = [1,60,3600,86400,604800,2678400,31536000]
⁸ - chain's left argument, N 3599
: - integer divide [3599,59,0,0,0,0,0]
µ - start a new monadic chain, call that X
¤ - nilad followed by links as a nilad:
“...» - compression of "second minute hour day week month year"
Ḳ - split at spaces = ["second","minute","hour","day","week","month","year"]
ç - call the last link (1) as a dyad - i.e. f(X,["second","minute","hour","day","week","month","year"])
- "minute"
Ç - call the last link (1) as a monad - i.e. f(X,X)
- 59
ṭ - tack [59,['m','i','n','u','t','e']]
K - join with spaces [59,' ','m','i','n','u','t','e']
”s - literal character '
¡ - repeat...
¤ - ...number of times: nilad followed by link(s) as a nilad:
⁸ - chain's left argument, X [3599,59,0,0,0,0,0]
Ç - call the last link (1) as a monad - i.e. f(X,X)
- 59
>1 - greater than 1? 1
; - concatenate [59,' ','m','i','n','u','t','e','s']
- implicit print - smashes to print "59 minutes"