さっきのやつを修正した.今回はちゃんと動いているぽい.
#!/usr/bin/env gosh (define (selectsort listdata) (define (exceptmax lst) (if (pair? lst) (if (= (fold max -1 lst) (car lst)) (cdr lst) (append (list (car lst)) (exceptmax (cdr lst))) ) () ) ) (if (pair? listdata) (append (selectsort (exceptmax listdata)) (list (fold max -1 listdata))) listdata ) ) (define (main args) (let ((inputlist `(9 0 1 8 2 7 3 6 4 5))) (print inputlist) (print (selectsort inputlist)) ) )