Scheme
Chez Scheme Version 8.4 tar -xzvf pcsv8.4-ti3osx.tar.gz cd csv8.4/costom ./configure --installprefix=~/local --installman=~/local/share/man make make install ãã㨠petite 㨠scheme-script ãã¤ã³ã¹ãã¼ã«ããããroot権éã«chownãããã¨ããâ¦
æ¦è¦ æ¨æ¥ãèªåèªèº«ãåºåããHaskellããã°ã©ã ãçæããOCamlããã°ã©ã ãçæããSchemeããã°ã©ã ãçæããRubyããã°ã©ã ãçæããJavaScriptããã°ã©ã ãçæããCããã°ã©ã ãæ¸ããã #include<stdio.h> int main(){char*g="var p=print;p('puts %%^(form</stdio.h>â¦
å¢ãä½ã£ã¦ãé©ç¨ã§ããã¡ã½ããããªããã° method-missing ãå¼ã³åºããæ©è½ãä½ã£ã¦ã¿ãï¼ (define-generic method-missing) (define-class <method-missing-generic> (<generic>) ()) (define-method apply-methods ((gf <method-missing-generic>) methods args) (if (null? methods) (apply method-missing gf arg</method-missing-generic></generic></method-missing-generic>â¦
ãã£ãã: ãã³ã¾ ãããèªãã§polyglotãããã¼ã£ã¦æã£ãï¼ ä»åã®ã³ã³ã»ãã㯠åãã¦ãªã®ã§ããããHello, world! 好ããªè¨èªãçãè¾¼ã 140æåä»¥ä¸ ä»¥ä¸ï¼Schemeã¨è¨ãã¤ã¤Gauche決ãæã¡ã§ããï¼ ã½ã¼ã¹ã³ã¼ã ã§ãããã£ãã®ãããï¼ ;(#)={-"^<"v 'â¦
Racketã®ç¶ç¶ãã©ããªã£ã¦ããã®ãï¼Racketã®ããã¥ã¡ã³ããèªã¿ã¤ã¤åãã£ããã¨ãã¾ã¨ããï¼ (注æ: ãã®è¨äºã¯ç¶ç¶ã®è§£èª¬ã§ã¯ãªãï¼å¯§ãç¶ç¶èªä½ã¯å¤§ä½åãã£ã¦ããåæã§é²ãã) ã¾ãï¼ä¸»ãªç¶ç¶ããªããã£ã´ã«ã¤ãã¦ç°¡åã«èª¬æããï¼æ¬¡ã«ï¼çµã¿åãããâ¦
MIT/GNU Scheme - GNU Project - Free Software Foundation ä»åã¯ç¡æ°åãªã®ã¨ãªãããããããã£ã¦ããåãããªãã®ã§ãã¤ããªãå ¥ããï¼"Compiled on OS X 10.6" ã ãï¼x86-64ã®ããã¦ã³ãã¼ããã¦ã³ãã¼ãã¦çµããï¼ ãã¨æããããã¹ã«ã³ãã³ãå ¥ã£ã¦ã¦â¦
c-wrapperï¼c-wrapper ã¯æ´æ°ããã¦ããªããã© http://hg.koguro.net/c-wrapper ã§æ´æ°ããã¦ããï¼ãã¦ã³ãã¼ãâã¿ã°ãããã¦ã³ãã¼ãã§ããï¼ ./DIST gen ./configure CC=/usr/bin/gcc make DYLD_INSERT_LIBRARIES=/usr/lib/libffi.dylib make checkæ®éã«â¦
æè¿ã®Haskellã«ã¯ãã¿ã¼ã³ã¬ã¼ãã¨ãããã®ããããããï¼ {-# LANGUAGE PatternGuards #-} addLookup alist x y | Just m <- lookup x alist , Just n <- lookup y alist = m + n | otherwise = 0 main = print $ addLookup [(1, 2), (3, 4)] 1 3 -- => 6 â¦
shift/reset ã¨åçç°å¢ã®é¢ä¿ã«ã¤ãã¦ããããèãã¦ããæã«åºã¦ããå¯ç£ç©ï¼ (use util.match) (define (capture/de proc) (match (let/cc de (list (proc de))) ((r) r) (thunk (thunk)))) (define (with/de de thunk) (let/cc cont (de (.$ cont thunk)â¦
(define-syntax alet1 (sc-macro-transformer (lambda (expr use-env) (let ((it-expr (cadr expr)) (var (caddr expr)) (expr1 (cadddr expr)) (body (car (cddddr expr)))) `(let ((it ,(make-syntactic-closure use-env '() it-expr)) (,var ,(make-syntaâ¦
(make-syntactic-closure environment free-names form) ã® free-names ã¯ï¼let ã§å ãã¤ã¡ã¼ã¸ã§ãããã ãããï¼ (let ((x 1)) (let-syntax ((foo (sc-macro-transformer (lambda (expr env) (let ((var (cadr expr))) (make-syntactic-closure var (list â¦
(use gauche.collection) (use gauche.mop.singleton) (define-class <zero-collection-meta> (<singleton-meta>) ()) (define-class <zero-collection> (<collection>) () :metaclass <zero-collection-meta>) (define-method call-with-iterator ((class <zero-collection>) proc :key start) (proc (^ () #t) (^ () (errâ¦</zero-collection></zero-collection-meta></collection></zero-collection></singleton-meta></zero-collection-meta>
ååããèé¨ã® i ã®ä»£ããã«!ã使ããããã«ãªã£ãã®ã¨ré²æ°(r>1)ã使ããããã«ãªã£ãï¼ã㨠$try ã足ããªãæããã£ãã®ã§è¶³ãããï¼ææ©ï¼R5RSã®æ°å¤ãªãã©ã«ã£ã½ããã®ã§ã¯ãªããªã£ã¦ãã¦ããï¼ ååã®36é²æ°ã®èé¨ãæ±ãã¨ããåé¡ï¼ã³ã¡ã³ããé ããâ¦
R5RSã®æ°å¤ãªãã©ã«ã®ãµãã»ãããæ¡å¼µãããã®ã®ãã¼ã¶ãparser.pegã§æ¸ããï¼å ·ä½çã«ã¯å°æåãã使ããªãã®ã¨ 123### ãåã£ã¦å°æ°ã10é²ä»¥å¤ã§ãæ¸ããããã«ããæãï¼ãã¨36é²æ°ã¨ææ°ãã¼ã«ã«^ã追å ï¼ parser.pegã¯undocumentedã§ããåãããªãã®â¦
ããªããç¨ Haskell golf ã®æç§æ¸ãèªãã§ã俺ãããããã®æ¸ãããï¼ãã¨æã£ã¦æ¸ãã¦ã¿ãï¼(æã£ã¦ããæ¸ãã¾ã§ã«1å¹´ãããçµã£ã¦ããã©) ã¢ããã¥ã¢ã´ã«ãã¡ã¼ãªã®ã§è³ãã¬æãããããã ãã©ï¼ä»å¾ã®Schemeçã¨ããªããçã®çãä¸ãããé¡ã£ã¦ãã®æç« â¦
ã¨ã©ãã¹ããã¹ã®ç¯© (define (divisor? x y) (eqv? 0 (remainder x y))) (define-constant +primes+ (stream-cons 2 (stream-filter prime? (stream-iota -1 3 2)))) ;; (define (prime? n) ;; (not (stream-any (cut divisor? n <>) (stream-take-while (cuâ¦
F# ã® |> æ¼ç®åããã£ãããã®ã§ãHaskell ã§ä½ã£ã¦ã¿ãã infixl 0 |> (|>) :: a -> (a -> b) -> b a |> f = f a 以ä¸ã®ããã«ã·ã§ã«ã®ãã¤ãã®ãããªæãã§ä½¿ãã foo :: String foo = [1..100] |> map (*2) |> filter (\x -> x `mod` 6 == 0) |> sum |> â¦
(rnrs records syntactic)ã¨srfi-17ãçµã¿åããã¦ä½¿ãããã£ããã ãã©ï¼ã©ããæåã§setterãset!ããªããã°ãªããªãããã ã£ãã®ã§ï¼ãã¯ãã®åå¼·ã¤ãã§ã«setterãset!ãã¦ããããã®ãæ¸ããï¼ æåã¯æç¶ãã§æ¸ãã¦define-record-typeã®å¾ã«ç½®ããããªâ¦
æ¥ãçµã£ã¦ããã®ã§ããè¦ãï¼ ãµã¤ãããMac OSåãã£ã½ãã®ããã¦ã³ãã¼ã å±éãã¦/Applications/ã«ã¶ã¡è¾¼ã "/Applications/Racket v5.0.2/bin"ã«PATHãéã ããã§plt-r6rsã§R6RSãåãï¼ãã ï¼ããã ã¨"/Applications/Racket v5.0.2/man"ã¨ãã¬ã³ç¡è¦â¦
Haskellã®scanlã«ç¸å½ãããã®ããªãã£ãã®ã§æ¸ããï¼ (ä¿®æ£ 9:24) (use gauche.collection) (define (scan-with-iterator+builder f seed end? next add! get) (let loop ((seed seed)) (add! seed) (if (end?) (get) (loop (f (next) seed))))) (define-meâ¦
gosh> (coerce-to <tree-map> '(("a" . 1) ("b" . 2))) WARNING: unknown keyword :size *** ERROR: real number required: "a" ããã¯=㨠ã¤ãã§ã«å¤ãªè¦ååºã¦ãï¼</tree-map>
(call/cc (lambda (k) (with-exception-handler (lambda (x) (print "condition: ") (print x) (k 'exception)) (lambda () (with-exception-handler (lambda (x) (raise (list 'foo x))) (lambda () (raise 'bar))))))) srfi-18ã®raiseã ã¨ç¡éã«ã¼ããã¦ï¼â¦
(dynamic-wind (lambda () (print 'before1)) (lambda () (define cont #f) (print 1) (dynamic-wind (lambda () (print 'before2)) (lambda () (print 2) (set! cont (call/cc values))) (lambda () (print 'after2))) (dynamic-wind (lambda () (print 'beâ¦
絶対ããããã¨æããã ãã©ã©ããã¦ãããªã£ã¦ããã®ã⦠(fold list 0 '(1 2 3) '(4 5 6)) ; => (3 6 (2 5 (1 4 0))) ãã®ä»æ§ã®æçºã§ï¼foldã®å®è£ ã§ç´ ç´ã«applyã§ããªããã ãã©â¦ å®è£ ãè¤éã«ãªã£ã¦ãã³ã¹ãã¯åããªãã ãããï¼ æå³çã«ãåºå®æ°ã®ãã®â¦
JavaScriptã§æ¸ãããSchemeå¦çç³»BiwaSchemeã«é¢ããã¡ã¢ï¼ R6RSæºæ ãç®æãã¦ããï¼ call/ccãä½æ ãæ§æ call-with-current-continuationãè©ä¾¡ãããã¨#ã ãã©call/ccã ã¨undefined(ã§ã使ãã) mapã®callbackã®ä¸ã§ä½ãããç¶ç¶ã®extentã(å¤å)mapã«â¦
Gaucheã®ãã㪠(lazy 3) ã許ãå¦çç³»ã ã¨ï¼å®ã¯delayã使ãæå³ã£ã¦ãªãã£ããããï¼
#/\"\"(|)/ ããæ¸ãã¦æå¾ã辺ã§é©å½ã«ãã¤ã³ãåããã¦ãã¨Emacsãããªã¼ãºããï¼ ä½¿ã£ã¦ãã®ã¯Carbon Emacsï¼ eldoc-modeåãã¨è½ã¡ãªããªã£ãï¼åã³eldoc-modeããã¨ãã¯ãããªã¼ãºï¼
ãããªæãã®sum-accãæ¸ãããã£ããã ãã©ï¼ãªããªã綺éºã«æ¸ããªãï¼ (sum-acc '(1 2 3 4)) ; => (1 3 6 10) ç´¯ç©åã®ãªã¹ãã£ã¦ããã®ããªï¼ ç´¯ç©ã£ã¦ãã¨ã§gauche.collectionã®map-accumã使ã£ã¦ã¿ãï¼ (use gauche.collection) (define (sum-acc lis) â¦
Common LispãSchemeã§ããã·ã¥ãã¼ãã«ãªãã©ã«ãç¡ãã®ã«ã¯çç±ããããæ大ã®çç±ã¯ããããã·ã¥ãã¼ãã«ãåç¾ããã«ã¯ãåè¦ç´ ã ãã§ãªãããã·ã¥é¢æ°ããã³æ¯è¼é¢æ°ã®æ å ±ãå¿ è¦ãã¨ããç¹ã ããã http://blog.practical-scheme.net/shiro/20100219-mâ¦
Gaucheã£ã¦ï¼ã¨ãããSRFI-1ã£ã¦map-reverseã¿ãããªã®ã£ã¦ãªãã®ãï¼ OCamlã«ã¯rev_mapããããããã®ããªã§åæã«å½ããåã®ããã«ããã¨æã£ã¦ããã©ãããªãã¨ã¯ãªãã£ãï¼ append-reverseã¯ããã®ã«â¦