ºî¼Ô: Bruce.
Æü»þ: 2005/2/21(22:53)
Bruce.‚Å‚·B

Perl‚âPython‚É”ä‚ׂĐL‚Ñ‚ªƒCƒ}ƒCƒ`‚Ȃ̂Ō͂ê–Ø‚àŽR‚Ì“ö‚í‚¢B

printf "%d/%d/%d", sub { $_[5]+1900, $_[4]+1, $_[3]}->(localtime);

‚Æ‚¢‚¤ƒeƒNƒjƒbƒN‚ð‚Q‚¿‚á‚ñ‚ÅŒ©‚©‚¯‚½‚Ì‚Å‚±‚ê‚ðRuby‚ŏ‘‚¢‚½‚ç
‚Ç‚¤‚Ȃ邾‚낤‚ƍl‚¦‚½B‚à‚Á‚Æ‚àAlocaltime‚ª‚È‚¢‚Ì‚Å‚ ‚Ü‚è
ˆÓ–¡‚Í‚È‚¢‚Ì‚¾‚ª(Î)

irb(main):045:0> printf '%d/%d/%d', (lambda{|*x| return
x[0],x[1],x[2]}.call(Time.new.year, Time.new.month, Time.new.day))
TypeError: cannot convert Values into Integer
        from (irb):45:in `printf'
        from (irb):45
        from :0

‚±‚±‚ł‚܂­B

‚ ‚ Aprintf‚ª”z—ñ‚ðˆø”‚É‚Æ‚Á‚Ä‚­‚ê‚ê‚΂¢‚¢‚Ì‚É‚Æ‚ ‚«‚ç‚ß‚©‚¯‚½
‚Æ‚±‚ë‚Å‚Ó‚ÆŽv‚¢o‚·B

irb(main):002:0> printf '%d%d%d' % [2+1, 3+1, 4+1]
345=> nil
irb(main):003:0>

‚ӂށB
Python‚à‚±‚¤‚¢‚¤‘‚«•û‚µ‚Ä‚½‚悤‚ȁB