Schemeããããã¯ããã¦1å¹´ãããããªï¼ã¤ãã©ãæéãé¤ãã¦ï¼ã
ã¾ã ã¾ã åãããªããã¨ã ããã
ãã®ä¸ã¤ããã·ã³ãã«ã
http://karetta.jp/book-node/gauche-hacks/023107ã§ç´¹ä»ããã¦ããFizzBuzzã®ã½ã¼ã¹ã³ã¼ãã ãã©ãã¼ãã¼ã£ã¨èªãã§ã¦æ°ã¥ãããã¨ãããã
ãã®Webãã¼ã¸ã®ã½ã¼ã¹ã³ã¼ãã¯ãæ¬ã®ããã¨å°ãç°ãªã£ã¦ããã
;; Webã®ã½ã¼ã¹ã³ã¼ã (map (lambda (x) (cond ((= (modulo x 15) 0) "FizzBuzz") ((= (modulo x 5) 0) "Buzz") ((= (modulo x 3) 0) "Fizz") (else x))) (iota 100 1)) ;; æ¬ã®ã½ã¼ã¹ã³ã¼ã (map (lambda (x) (cond [(= (modulo x 15) 0) 'FizzBuzz] [(= (modulo x 5) 0) 'Buzz] [(= (modulo x 3) 0) 'Fizz] [else x])) (iota 100 1))
ãããªæããæååããã·ã³ãã«ãã®éãã
ãªãã§éãã®ï¼æå³ã®ä¸ã§ãã©ãããéããããã®ï¼
The Little Schemerã®æå¾ã®ç« ã§æ¬¡ã®ãããªæç¶ãvalueãä½ã£ããï¼id:yagiey:20081107:1226069483ï¼
gosh> (value '(car (quote (a b)))) a
ããã¤ããèãã¦ããã¨...
ãcarãããaãããbãã¯ããããæç¸ãããååã
è©ä¾¡ãã¦ãã¾ãã°ä½ããã®ãªãã¸ã§ã¯ãï¼å¤ã ã£ããæç¶ãã ã£ããï¼ã«ãªã£ã¦ãã¾ãã
ã ãã©ãããããè©ä¾¡ããã«ãååã®ã¾ã¾ã½ã¼ã¹ã³ã¼ãã«ç½®ãã¨ããã£ã¦ãã¨ã ããã
ããã£ã¦ã©ãããæå³ã ããããããããã
gosh> (define Fizz 42) Fizz gosh> Fizz 42 gosh> 'Fizz Fizz
ã£ã¦ã®ã¯ãCè¨èªã®é ã§èããã¨
int Fizz = 42; printf("%d\n", Fizz); printf(Fizzã®å¤æ°å); // ã§ããªããã©
ã¿ãããªæããªã®ããªã
Cã®æ¹ã¯ãå®è¡æã«å¤æ°åãåãåºãã¦ãã¦æååã«ããã¨ãã§ãããã
ãã¨ãã·ã³ãã«ã®å ´åã¯ãããæç¸ããã¦ãããã©ããã¯ã©ãã§ãè¯ãã£ã½ãï¼ä¸å¿defineãããã©ï¼ã
ãã¡ããSchemeã®æ¹ã¯ç»é¢ã«åºåãããããè©ä¾¡ãã¦ãããããããªããããprintfã¨ã¯ç価ãªãããªããã©ã
ã¤ã¾ããã·ã³ãã«ã£ã¦ãã¡ã¿ããã°ã©ãã³ã°çãªãã¨ãããå ´åã«ãããåºã¦ãããããªã
ããããã°ãæç¶ãvalueãã¡ã¿ããã°ã©ãã³ã°ã ããã
...ã§ãçµå±ã·ã³ãã«ã£ã¦ãªããªã®ï¼(´ï¼Ïï¼ï½)
ã³ã¡ã³ããåãã¦
...ã£ã¦ãªããã§ãæååã¯equal?ã#tãã¤eq?ã#fã«ãªããããªã¤ã³ã¹ã¿ã³ã¹ã¯æ²¢å±±ãããã©ãã·ã³ãã«ã¯equal?ã#tãªãã°eq?ã#tã«ãªãã£ã½ãã
ããããã°ã
åç´ãªãã¼ã¿åã§ã¯ãçå½å¤ã¨ã·ã³ãã«ã®ã¿ãeq?ã§ç¢ºå®ã«æ¯è¼ã§ãããã¨ãä¿è¨¼ããã¦ããã
いろいろな「等しさ」 - チキン煮込みチーズミックス4辛
ã£ã¦æ¸ãããã©ããããããã¨ã ã£ãã®ãã¼ã
ã£ã¦ãããããSmalltalk 㯠Lisp ã®å½±é¿ãå¼·ãåãã¦ãããã£ã¦ã®ã¯æå¤ã ãªãã
Smalltalkãããä½è£ã¯ä»ã¯ç¡ããã©ããã¤ããã£ã¦ã¿ãããªã