消えてなくなれよ >オブジェクト指向
at TECH
433:デフォルトの名無しさん
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
5505日前に更新/139 KB
担当:undef