2007-12-17から1日間の記事一覧

cygwinというかwindowsではアスタリスクをファイル名に出来ない?

$ echo -e '#include <stdio.h>\nint main(){FILE *f;f=fopen("./a.txt","w");fprintf(f,"hello,world");}'> a.c;gcc a.c ; ./a.exe $ cat a.txt $ echo -e '#include <stdio.h>\nint main(){FILE *f;f=fopen("./*","w");fprintf(f,"hello,world");}'> a.c;gcc a.c ; ./a.exe S</stdio.h></stdio.h>…

schemeでリスト中に同じ要素が並んでいるか判定する

(define (is-prefix xs ys) (if (null? xs) #t (if (null? ys) #f (if (eq? (car xs) (car ys)) (is-prefix (cdr xs) (cdr ys)) #f)))) (define (match xs ys) (if (null? ys) #f (if (is-prefix xs ys) #t (match xs (cdr ys))))) (print (match '(3 5) '(1…