Java8ã§é¢æ°ãå¤ã¨ãã¦æ±ããããã«ãªãã¾ããã
ãã®ãã¨ãããé¢æ°ã渡ããã¨ä¾¿å©ã ãããã¨ãã観ç¹ã§ã¯ãªããããã°ã©ãã³ã°è¨èªã¨ãã¦ã®è½åãã©ã®ããã«ããããèãã¦ã¿ã¾ãã
åè«ããã®ãã¯ããã¯ã使ãããããªã
éåè«ã¯ã©ã¡ããã¨ããã¨å¤ã«ããããçè«ã§ããããåè«ã¯é¢æ°å¼ã³åºãã«é¢ããçè«ã§ãã
ããã°ã©ã ã«ã¯ãé¢æ°å¼ã³åºããé£çµããã¦å¤ãå¤æãã¦ããã¨ããå´é¢ãããã¾ãã
ãã®ãããªé¢æ°å¼ã³åºãã®æ±ãæ¹ãæ´çããã®ãåè«ã§ãåè«ã®èãæ¹ã使ããã¨ã§ããå®å®ããããã°ã©ã ãæ¸ããã¨ãã§ãã¾ãã
ã¢ãããªã©åè«ç±æ¥ã®ãã¯ããã¯ã使ãã«ã¯ãã©ããã¦ãé¢æ°ãå¤ã¨ãã¦æ±ãå¿
è¦ãããã¾ãã
é¢æ°ãå¤ã¨ãã¦æ±ããã¨ã§ãåè«ã®ãã¯ããã¯ã使ãããããªããå®å®ããããã°ã©ã ã®æ¸ããããã«ã¤ãªããã¾ãã
åã®è¨¼æè½åãããã
åçãªåä»ã®è¨èªã«ããã¹ã¦ãéçãªåä»ã®è¨èªã¯ããã°ã©ã ãééãã«ããã¨ãããã¾ãã
ã³ã³ãã¤ã«æã«æ¤æ»ãã§ãããããªã®ã§ãããåã®æ¤æ»ãéãã¨ãããã¨ã¯ãå®ã¯è¨¼æãè¡ãããã¨ãããã¨ã«ãªãã¾ãã
ã«ãªã¼ã»ãã¯ã¼ãåå対å¿ã¨ãã£ã¦ãããã°ã©ã ã®åã¨ãè«çã®è¨¼æã¯ãåããã®ã§ãããã¨ã示ããã¦ãã¾ãã
ã¤ã¾ãããAã¨ããåã§ãããã¨ãããã¨ã¯ããAã§ãããã¨ãããã¨ã®è¨¼æã§ãã
ããã¦ããAã¨ããå¼æ°ãã¨ã£ã¦Bãè¿ãé¢æ°ããå®è£
ãããã¨ã¯ãAãªãã°Bã§ããããã¨ã®è¨¼æã«ãªãã¾ãã
é¢æ°ãå¤ã¨ãã¦æ±ããã¨ã§ã¯ãå®éã«ã¯è¨¼æè½åã¯å¤ããã¾ããããå½é¡ã®è¨è¿°ãããããå¤ãããã³ã³ãã¤ã«ãéã£ãæç¹ã§ä¿è¨¼ã§ããç¯å²ãåºãããããªãã¾ãã
åã«ãã証æ
åã«ãã証æã«ã¤ãã¦è£è¶³ãã¦ããã¾ãã
ãã¨ãã°
Flyable proof(Bird a)
ã¨ããé¢æ°ã®å®è£ ã¯ããBirdãªãã°Flyableã§ãããã¨ãããã¨ã®è¨¼æã§ãã
å¼æ°ããµãã¤ã¨ãã¨ãããã¯ããã¤ãã«ãªãã¾ãã
Pettable proof(Bird a, Small s)
ã¨ããé¢æ°ã®å®ç¾©ã¯ãBirdã§ããããã¤Smallãªãã°ãPettableã§ãããã¨ãããã¨ã®è¨¼æã§ãã
(Pettableã¨ããåèªããããã©ããããã¾ããããããã§ã¯é£¼ããã¨ãã§ããç¨åº¦ã®æå³ã ã¨æã£ã¦ãã ãã)
é¢æ°ãå¤ã¨ãã¦ä½¿ããããã«ãªãã¨ãããªãã°ããåææ¡ä»¶ã«çµã¿åããããã¨ãã§ãã¾ãã
ãã¨ãã°
Flyable proof(Bird a, Function
f)
ã¨ããé¢æ°ã®å®è£
ã¯ãBirdã§ããããã¤Birdãªãã°Flyableã§ãããªãã°ãFlyableã§ãããã¨ãã証æã«ãªãã¾ãã
ãã®å ´åããreturn f.apply(a)ãã¨ããã°BirdãFlyableãã©ã®ãããªãã®ã§ãããã«ããããã常ã«å®è£
å¯è½ã§ããã¤ã¾ããããã¯æçå¼ã§ããã¨ãããã¨ã§ãã
ä¸æ®µè«æ³ã®è¨¼æãå¯è½ã§ãã
Function
proof(Function fc, Function fb)
ã¨ããé¢æ°ã®å®è£
ã¯ããCrowãªãã°Birdããã¤Birdãªãã°Flyableã§ããã°ãCrowãªãã°Flyableãã¤ã¾ããã«ã©ã¹ãé³¥ã§ãããé³¥ãé£ã¶ãªãã°ãã«ã©ã¹ã¯é£ã¶ãã¨ãã証æã§ãã
ãã®å®è£
ã¯
return (Crow c) -> fb.apply(fc.apply(c));
ã¨ããã°å¸¸ã«å¯è½ã§ããå°ã
è³¢ãæ¨è«ã¨ã³ã¸ã³ãããã°ãèªåçã«ããã¾ããã¤ã¾ãèªæã¨ãããã¨ã§ãã
ä¸æ®µè«æ³ã証æã§ãã¾ããï¼
ã¤ãã®ãããªé¢æ°ãããã¨ãã¾ãã
Function
proof(Function ff, Function fb)
ããã¯ãCrowãªãã°Flyableããã¤Crowãªãã°Blackã§ããã°ãBlackãªãã°Flyableãã¤ã¾ããã«ã©ã¹ã¯é£ã³ãã«ã©ã¹ãé»ããªãã°ãé»ããã®ã¯é£ã¶ãã¨ããè«çå¼ã«å¯¾å¿ãã¾ãã
ãããããã¯ãç¡æ¡ä»¶ã§ã¯å®è£
ã§ãã¾ãããèªæã§ã¯ãªãã¨ãããã¨ã§ãã
å®è£
ããã¨ãããã次ã®ããã«ãªãã¾ãã
return (Black b) -> { if (b instanceof Crow) return ff.apply((Crow)b) else throw new RuntimeException()}
é»ããã®ãã«ã©ã¹ã®å ´åã ãé£ã¶ããã§ãããã¾ããExceptionãæãããã¤ã¾ãé¢æ°ãçµäºããªãã¨ãããã¨ã¯ãè«çã¨ãã¦ã¯å½ãããããã¾ãããã¶ãã
ãã¾ãã¾ãªè¨¼æãè¡ããã¨ããã¨ãJavaã®åã·ã¹ãã ã§ã¯å
¨ã足ãã¾ããããé¢æ°ãæ±ããã¨ã§è¨¼æã®è½åãããããã¨ã¯ç¢ºãã§ãã
åèæ¸ç±
åè«ãããã°ã©ã ã®æèã§èª¬æãã¦ããæ¬ã«ã¯ããããã°ã©ã æå³è«ããããã¾ãããã«ãã´ãªã¼çè«ãã¨ããã®ãåè«ã§ããããããããã«ãã©ãã¤ãã¾ã§ãçµæ§ã¤ããããã¨ãã¢ãã¤ãã®èª¬æãªã©ãåè«ã®æèã¨ãã¦ã¯ãã¾ãå³å¯ã§ãªã表ç¾ãããæãã§ãã
ããã°ã©ã æå³è« (æ å ±æ°å¦è¬åº§)
- ä½è : 横å å¯æ
- åºç社/ã¡ã¼ã«ã¼: å ±ç«åºç
- çºå£²æ¥: 1994/06/01
- ã¡ãã£ã¢: åè¡æ¬
- è³¼å ¥: 2人 ã¯ãªãã¯: 57å
- ãã®ååãå«ãããã° (17件) ãè¦ã
åè«ãã¿ã¤ãã«ã«ãªã£ã¦ããæ¬ã¯ãï¼åã»ã©ããååãç®ã«ãã¾ããã竹å
å
çã®æ¬ãããããã§ãã
層ã»åã»ããã¹âç¾ä»£çéååãæ±ãã¦
- ä½è : 竹å å¤å²
- åºç社/ã¡ã¼ã«ã¼: æ¥æ¬è©è«ç¤¾
- çºå£²æ¥: 1978/01/20
- ã¡ãã£ã¢: åè¡æ¬
- è³¼å ¥: 3人 ã¯ãªãã¯: 39å
- ãã®ååãå«ãããã° (18件) ãè¦ã
ãåè«ã«ããè«çå¦ããæã£ã¦ãã¾ãããè«çå¦ã¨å¯¾æ¯ãã¤ã¤é²ãã§ããã®ã§ãåè«ã ããåå¼·ãããã¨ããã¨ã¡ãã£ã¨èªã¿ã«ããã§ãã
ã«ãªã¼ã»ãã¯ã¼ãåå対å¿ã«ã¤ãã¦ã¯ããè«çã¨è¨ç®ã®ããã¿ãã®æå¾ã«è¼ã£ã¦ãã¾ãã
- ä½è : è©è°·æå·±,西å´çä¹
- åºç社/ã¡ã¼ã«ã¼: 岩波æ¸åº
- çºå£²æ¥: 2007/06/27
- ã¡ãã£ã¢: åè¡æ¬
- è³¼å ¥: 14人 ã¯ãªãã¯: 442å
- ãã®ååãå«ãããã° (36件) ãè¦ã
ãã ãè«çç³»ã®æ¬ã§ã¯åã¨è«çãã©ã®ããã«å¯¾å¿ãããã®èª¬æã§ãããã¨ã«å¯¾ãã¦ããã®æ¬ã§ã¯ãã«ãªã¼ã»ãã¯ã¼ãåå対å¿ãã©ã®ãããªä¾¡å¤ãããããã©ã®ãããªæå³ããã¤ãã¨ãã解説ãããã¦ãã¦ãé常ã«ããããã§ããæ®å¿µãªãã絶çã§ããã©ã
ç¥ã®æç§æ¸ãè«çã®å²å¦ (è¬è«ç¤¾é¸æ¸ã¡ãã¨)
- ä½è : 飯ç°é
- åºç社/ã¡ã¼ã«ã¼: è¬è«ç¤¾
- çºå£²æ¥: 2005/09/10
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- è³¼å ¥: 1人 ã¯ãªãã¯: 25å
- ãã®ååãå«ãããã° (43件) ãè¦ã