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.