ã¯ããã« ç§ãå人ã§æ¨å¹´ã® 6 æããããéçºãã¦ããé¢æ°åããã°ã©ãã³ã°è¨èªãç´¹ä»ãããè¨èªã®ååã¯ãPlatoãã§ããã ãã®è¨èªã¯æ¨å¹´ã® U22 ããã°ã©ãã³ã°ã³ã³ãã¹ãæçµçºè¡¨ä¼ã§ãçºè¡¨ãããã³ã³ãã¹ãå¾ãã³ã³ãã¤ã©ã®æ§æã¨å®è£ ã«é¢ãã¦èª¿æ»ãç´ãã¦ãã³ã¼ããä¸ããæ¸ãç´ãããã³ã³ãã¤ã©ã¯ Haskell ã§æ¸ããã¦ãããããæ¬ç¨¿ã®å 容ã Haskell ã®ç¥èããã¼ã¹ã¨ãã¦ãããã¾ããåçè«ã®ç¥èãããç¨åº¦æ±ããããããã ã大éæã«æ¸ãã¦ããããã大éæã«èªãã°ããããã®ããã°ã®èªè§£ã«æ£ç¢ºãã¯å¿ è¦ç¡ãã ãã®ããã°ã§ã¯ãã¾ã Plato ã®ãã¥ã¼ããªã¢ã«ã示ããå®éã«ä½ãã§ããã®ãã説æããã次ã«åæ¤æ»ãä¸éè¨èªã®ä»æ§ãªã©ã³ã³ãã¤ã©ã®å®è£ ææ³ã大ã¾ãã«èª¬æãããæå¾ã«ä»å¾å®ç¾ãããæ©è½ãªã©ã«ã¤ãã¦è¿°ã¹ããçè«çã«é¢ç½ããã®ãæç¨ãªæ©è½ã«ã¤ãã¦ã¯ãå¾æ¥ããå°ç¨ã®è¨äºãæ¸ãäºå®ã ãã¥
// å²ã2ãããé¢æ°ã®å¼æ°ãå¶æ°ã§ãããã¨ãåã«ãã£ã¦å¼·å¶ããä¾ï¼å®ç¨æ§ã¯ãªãï¼ data O // æ°åã®0ã表ããã¼ã¿å data S(A) forall { A } // +1ã表ããã¼ã¿å // åã¨ã¤ãªã¢ã¹ type Nat = O | S[Nat] // éå¹çãããä»åé·æ´æ° type Even = O | S[Odd] type Odd = S[Even] // å¶æ°ãå¼æ°ã«ã¨ã£ã¦2ã§å²ã£ãçµæãè¨èªçµè¾¼ã¿ã®æ´æ°ã¨ãã¦è¿ãé¢æ° div2 : Even -> I64 = // ç¶²ç¾ æ§ãã§ãã¯ã¤ãã®ãã¿ã¼ã³ããã | O => 0 | S(S(n)) => 1 + n.div2 TL;DR ã¦ããªã³åã¯ç´ååã®ä¸ä½äºæã§ããï¼è¿½è¨ããï¼ãé¢æ°åè¨èªãä½ãã¨ãã¯ç´ååã®ä»£ããã«ã¦ããªã³åãæ¡ç¨ããã®ãããã ã¯ããã« Cottonã¨ããããã°ã©ãã³ã°è¨èªã2021å¹´ã®å¤é ããä½
ãããããã¤ã¼ãã話é¡ã«ãªã£ã¦ããã ãé åã®ãã¹ã¦ã®è¦ç´ ãæ¡ä»¶ãæºãããªãtrueãè¿ããé¢æ°ãå®ç¾©ããã¨ãã空ã®é åã渡ãããfalseãè¿ããtrueãè¿ããããè¯ãããã°ã©ããã©ããã®ä¸ã¤ã®å¢ç®ã â ãµã¿ (DJ Monad) (@fumieval) 2023å¹´5æ29æ¥ ã¤ã¾ãScalaã§è¨ãã¨æ¬¡ã®ãããªã³ã¼ããä½ã«ãªãããã¨ãããã®ã§ããã val xs = Seq.empty[Int] xs.forall(_ == 42) çµè«ããè¨ãã¨ããã®ãããªé¢æ°ã¯å¸¸ã«trueãè¿ãã ãªãã ããï¼ãã®çç±ããããã説æããã ã¡ãªã¿ã«ä»ã«ä»¥ä¸ã®ãããªæè¦ããã£ã: ä»æ§ã«ãã ä¾å¤ãæããã¹ã ããããã¾ãããããªãã¯ãªãããããã¦ãããã»ããè¯ãã¨æããããä»®ã«falseãè¿ããããªä»æ§ããã£ãå ´åãããã¯æ°å¦ããä¹é¢ãã¦ããã®ã§ãããä»æ§å é¨ã§çç¾ããå¯è½æ§ãé«ãã*1ãæçµçã«
ãã®è¨äºã¯Scala Advent Calendar 2022ã®19æ¥ç®ã§ã. Scalaã§ã¯ã¸ã§ããªãã¯åã®å¤æ§(variance)ã¯+ã-ã§æå®ãã¾ãã, ä»ã®è¨èª(ãã¨ãã°, C#, Kotlin)ã§ã¯outãinã ã£ãããã¾ã. ãã®è¨äºã§ã¯å¤æ§ã®æå³ãæ´çãã¦, ãªãScalaã§ã¯+/-ã®è¨å·ã使ãã®ã説æãã¾ã. 追è¨ãã ã, ããã§èª¬æãã¦ããå 容ã¯åºæ¬çã«C#ãKotlinã§ãæç«ãã(ã¯ããª)ã®ã§ããªããããã®è¨èªã§ã¯+/-ã®è¨å·ã使ããªãã®ããã説æãããã®ã§ã¯ããã¾ãã. å人çã«ã¯+/-ã®æ¹ãããããããã¨æãã, out/inã®è¨æ³ã¯æ±ã£ã¦ããæ¦å¿µãç°¡åã§ãããã®ãããªèª¤è§£ãçã(æªãè¨ãã°é¨ã)ã®ã§ã©ã¡ããã¨è¨ãã¨å«ãã§ã. çºç«¯ ãããã話é¡ãããã¾ãã. Scala ã¯å ±å¤ã + ã§ãåå¤ã - ãªã®ã§çè«éè¦ï¼ ãªã®ã«å¯¾ãã¦ãKotlin 㨠TypeSc
Coqã§å¦ã¶è¨¼æããã°ã©ãã³ã°ï¼Â ãã¹ãã ãã§ãªãã証æãã§å®å ¨æ§ãä¿è¨¼ãã ããã°ã©ãã³ã°è¨èªãCoqãã§ã¯ãããã°ã©ã ãã証æããã¦ééããé²ããã¨ãã§ãã¾ããããã°ã©ã ã®æ£ãããä¿è¨¼ã§ããä¸æ©é²ãã ã¨ã³ã¸ãã¢ã«ãªãã¾ãããï¼Â coqtokyoã主å¬ããä»äºå®æ´ããã®è§£èª¬ã§ãã ã¿ãªãããCoqã£ã¦ãåç¥ã§ããï¼ ããã°ã©ã ã証æãã¦ééããé²ãã¨ããåªããã®ã§ããä»åã¯ãã®Coqã«ã¤ãã¦ãcoqtokyoã¨ããåå¼·ä¼ã主å¬ãã¦ããä»äºå®æ´ããå±ããã¾ãã ããã°ã©ã ããã ä½ãã ãã§ã¯ãªãããã®æ£ãããä¿è¨¼ã§ããä¸æ©é²ãã ã¨ã³ã¸ãã¢ã«ãªã£ã¦ã¿ã¾ãããï¼ Coqã£ã¦ä½ï¼ ããã°ã©ã ãã証æãããã£ã¦ã©ããããã¨ï¼ Coqã使ã£ã¦ã¿ãã Coqã®ã¤ã³ã¹ãã¼ã«æ¹æ³ CoqIDEï¼Coqã«ãã証æéçºã®ããã³ãã¨ã³ã Coqã§é¢æ°ããã°ã©ãã³ã° ããã°ã©ã ã®ä»æ§ãè¨è¿°ããã 証æéçºã¢ã¼ã ã´
20åã§ããã Purely Functional Data Structures k.inaba (http://www.kmonos.net/) Apr. 4, 2010 ãããã 㤠ã 㥠㼠㿠ã ã« ã ã¼ ã¿ æ§ é 㯠é ã Immutable Object ã ãã§ä½ããã¼ã¿æ§é ãã®æ¬ã® å 容ã å ¨éå㧠å¸æãã ãé¡ï¼ãã¥ã¼ (Queue) ⢠FIFO (First-In First-Out) ⢠pushBack(e) ã§ãã¼ã¿eãå ¥ãã ⢠popFront() ã§åãåºãã â¢ å ¥ããé ã«åºã¦ãã â¢ ä»¥ä¸ ç ´å£çãã¥ã¼ Immutable Object ã§ãªã æåãã¹ãç®æ¨ 代 å ¥ æç¶ãåã§ãããã interface Queue<E> { void pushBack(E e); E popFront(); } ããããå®è£ 1 2 3 ã» 4 ã»
è¿æ³ ãµã¨ããç¬éã«èãããªããã¨ããã ããã㤠ä»å¹´ãç§åã·ã¹ãã ããé¢æ°åããã°ã©ãã³ã°ã«é¢ããæ¬ãåºã¦ãè¯ããæªããããã®æ¬ã注ç®ãéãããã¨ã«ãªã£ã¦ãã¾ãã¾ããããããªä¸ã§è²ã ãªäººãåå¿ãã¦ãã¾ããããèªåããã®ãããªããã¡ã§ææ³ãæ¸ãã¾ããã ä¸æ¹ã§ããã®ãããªæ¬ãæ¸ããããããã§ãããªãã°ãèªåã§çã£å½ãªæ¬ãæ¸ãã°ããããã ããæè¡æ¸ãæ¸ããã¨ãªãã¦ããããªæ·å± ã®é«ããã¨ã§ã¯ãªãã¨ããã«ã¦ã³ã¿ã¼ããããå人çã«ã¯ãããæãã ãªããã¨ããå°è±¡ãããã¾ããããã®ä¸ã§èªåãªãã«é¢æ°åããã°ã©ãã³ã°ã«ã¤ãã¦ç解ãããã¨ãå ã«Qiitaã«é§æãã¢ããããããã¦ãã¾ãããééã£ã¦ããã誰ããè¨æ£ãã¦ãããã ãããããã®ã»ããèªåã«ã¨ã£ã¦åå¼·ã«ãªãã ãããã¨æãã®ã§ã ã§ããããé¢æ°åããã°ã©ãã³ã°ãã¨ããã®ã¯ããªãã ãé£ãããã¨ããå°è±¡ãè¦ããã®ãäºå®ã®ããã§ããå®éã«ãææ°ã®ãSoft
åç½®ãï¼ ç¹å®ã®è¨èªã§ã¯ãªããé¢æ°åè¨èªä¸è¬ã«é¢ãã説æã§ãã ããã«æ¸ãã®ãè¯ãã®ããããã¾ãããããããèããæéããã£ãããªãã®ã§ã¨ããããæ¸ãã¾ããå¿ è¦ãçããã移転ãã¾ãã çæ§ã®ãè¦æãèªåã®æ°å(?)ã«ããéæå çä¿®æ£ãã¾ãã ãããã¯éãããããªãï¼ãã¨ãããææã¯ãã¡ãããåå¿è ã®æ¹ã®ç´ æ´ãªçåã»è³ªåããããããããããããªããããããããã¨ãæ¸ãã¦ã»ãããã¿ãããªã³ã¡ã³ããæè¿ãã¾ããããã«å¯¾å¿ã§ããªãå ´åãããã¨æãã¾ãããã¿ã¾ãããTwitterã®esumiiå®ã§ãæ§ãã¾ããããã³ã¡ã³ãã®ã»ããä»ã®æ¹ãè¦ã¤ããããã¦è¯ãã¨æãã¾ããå½ç¶ãªããï¼ä»è ã«å¯¾ãã¦ãï¼èª¹è¬ä¸å·çã¯ãé æ ®ãã ããã ããã ããã³ã¡ã³ãã¯ã»ã¼æ¬æã«åæ ãã¦ãã¾ãã®ã§ãæ¬æãèªãããã«ãå¿ ãããã³ã¡ã³ããèªãå¿ è¦ã¯ããã¾ããããã¡ãããèå³ã¨ä½è£(?)ãããã°ã³ã¡ã³ããèªãã§ããã ããã°é常ã«æç¨
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}