真ん中優先。真ん中がないときは右側優先。
(define thin-out (lambda (lis n) (let* ((r (- (length lis) n)) (a (if (= (mod r 2) 0) (/ r 2) (+ (div r 2) 1))) (b (+ a n))) (append (take lis a) (drop lis b))))) (print (iota 10)) (print (thin-out (iota 10) 1)) (print (thin-out (iota 10) 2)) (print (thin-out (iota 10) 3))
^o^ > gosh thin-out.scm (0 1 2 3 4 5 6 7 8 9) (0 1 2 3 4 6 7 8 9) (0 1 2 3 6 7 8 9) (0 1 2 3 7 8 9)