消えてなくなれよ >オブジェクト指向at TECH
消えてなくなれよ >オブジェクト指向 - 暇つぶし2ch433:デフォルトの名無しさん
09/03/07 18:33:13
>>415
(define (oremove o l)
(if (pair? l)
(if (eq? o (car l))
(cdr l)
(cons (car l) (oremove o (cdr l))))
l))
(define (perm s)
(define n 0)
(define (perml f l y)
(if (pair? l)
(for-each (lambda(x) (perml f (oremove x l) (cons x y))) l)
(f (reverse y))))
(perml (lambda (y) (display (list->string y)) (newline) (set! n (+ n 1))) (string->list s) '())
n)

(perm "123456789")
123456789
123456798

987654312
987654321
=>362880

(* 1 2 3 4 5 6 7 8 9)
=>362880


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch