This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shiro@scherzo:~/src$ gosh ./tt.scm a b c gosh ./t.scm | |
shiro@scherzo:~/src$ cat a | |
out | |
out | |
out | |
out | |
out | |
out | |
out | |
out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shiro@scherzo:~/src$ gosh ./t.scm 3>c > >(tee a >&3) 2> >(tee b >&3) | |
shiro@scherzo:~/src$ cat a | |
out | |
out | |
out | |
out | |
out | |
out | |
out | |
out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define x 0) ; x_0 | |
(let ((x 1)) ; x_1 | |
(let-syntax ((foo (syntax-rules () | |
((_) x)))) | |
(let ((x 2)) ; x_2 | |
(foo)))) ; => 1 | |
;; fooの展開で現れるxは、fooの使用位置から見えるx_2ではなく、 | |
;; fooの定義位置から見えるx_1。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gosh> (let-syntax ((foo (syntax-rules () ((_ a) (quote (a a)))))) | |
(%macroexpand (foo foo))) | |
(#<identifier user#quote.1c06de0> (foo foo)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use gauche.sequence) | |
;; (xrotate '(x a b c d e) 3) -> (a b c x d e) etc. | |
(define (xrotate lis n) | |
`(,@(subseq lis 1 (+ n 1)) ,(car lis) ,@(drop lis (+ n 1)))) | |
(define (digit->column n) | |
`(#\# ,@(xrotate '(#\o #\|) (div n 5)) #\# ,@(xrotate '(#\| #\o #\o #\o #\o) (mod n 5)) #\#)) | |
(define (num->columns num width) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-library (scheme linear-algebra) | |
(import (rename (scheme base) (* r7rs:*))) | |
(export *) | |
(begin | |
(define (* x y) | |
(if (or (array? x) (array? y)) | |
(array-multiplication x y) | |
(r7rs:* x y))) | |
(define (array? obj) ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/class.c b/src/class.c | |
index cdebd2c..9b6a1e3 100644 | |
--- a/src/class.c | |
+++ b/src/class.c | |
@@ -2701,6 +2701,11 @@ static void accessor_method_slot_accessor_set(ScmAccessorMethod *m, ScmObj v) | |
* Foreign pointer mechanism | |
*/ | |
+/* foreign pointer instance flags */ | |
+enum { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar orig-list-reader (get-macro-character #\()) | |
(set-macro-character #\( (lambda (stream ch) | |
(let ((lis (funcall orig-list-reader stream ch))) | |
(if (eq (car lis) 'comment) (values) lis)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; モジュールgauche.baseがr7rsを読まないと定義されないので、読んどく (次のバージョンで直す) | |
(require "r7rs") | |
;; gauche.baseから不要なもの以外をインポート | |
(import (gauche.base :except (quote))) | |
;; 継承を切る | |
(extend) | |
;; define => #<syntax define> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (map_ proc lis) | |
(map1 proc lis 0)) | |
(define (map1 proc lis n) | |
(cond [(null? lis) '()] | |
[(> n 30) (reverse (fold (^[elt r] (cons (proc elt) r)) '() lis))] | |
[else (cons (proc (car lis)) (map1 proc (cdr lis) (+ n 1)))])) | |
#| | |
gosh> (use gauche.time) |