J 79
echo((6!:0'')(('',:'Happy birthday to me!'){~])@:-:&(1 2&{)&:>])1{,1!:0{:4!:3''
보너스 버전 120-15 % = 102
둘 다 생일을했을 때 두 가지 모두 인쇄에 대한 추가 크레딧을 받습니까?
echo((2 6$(6!:0 '') , 0 2 7)(' ','Happy birthday to ',"2 1]3 5$'you! me! both!'){~#.@:(-:&(1 2&{)"1)&:>])1{,1!:0{:4!:3''
설명 (오른쪽에서 왼쪽) :
last =: {:4!:3'' NB. Take the last script run (i.e. the file itself)
time =: 1{,1!:0 last NB. the modification time is the second element in that file's listing
열차 의 중심 동사
unbox_both =: &:> NB. unboxes left and right argument
match =: -:&(1 2&{)"1 NB. for each date given, left and right, compare them
to_int =: #. NB. convert boolean to int
from =: {~ NB. from the left array, take element right.
NB. H contains messages an empty row, appended to all combinations of messages.
H =: (' ','Happy birthday to ',"2 1]3 5$'you! me! both!')
V =: (H from to_int)@:match unbox_both NB. after unboxing and comparing,
NB. select the according message
중앙 열차의 왼쪽 타인 :
dates=: (2 6$(6!:0 '') , 0 2 7) NB. the current date, and the relevant fields of my birthday.
NB. Combining the bricks:
echo (dates V ]) time NB. output the monads result on time.