scheme でもうすこしできた。
(define last-data10b '()) (define count-in 0) (define count-out 0) (define (line-scaler data10b last-flag) ;; (if (= count-in count-out) (assert (null last-data10b))) (print `(,count-in ,count-out)) (let ((new-value12b (if (= count-in count-out) (* data10b 4) (let* ((norm-x1 (- count-in count-out)) (norm-0x (- 4 norm-x1))) (blend10bx4 last-data10b norm-0x norm-x1 data10b))))) (set! count-in (+ count-in 4)) (set! count-out (+ count-out (if (= (- count-in count-out) 3) 6 3))) (set! last-data10b (if last-flag (define last-data10b '()) data10b)) ;;set '() for debug new-value12b))
グローバル変数を使っていてダサい。継続を使ったほうがスマートか?