|
|
@ -6,14 +6,17 @@
|
|
|
|
(apply append (map (curry make-list (add1 i)) '(0 1 0 -1)))))
|
|
|
|
(apply append (map (curry make-list (add1 i)) '(0 1 0 -1)))))
|
|
|
|
|
|
|
|
|
|
|
|
(define (fft str [phase-count 1])
|
|
|
|
(define (fft str [phase-count 1])
|
|
|
|
(for/fold ([ints (for/list ([c (in-string str)])
|
|
|
|
(define ints (for/list ([c (in-string str)])
|
|
|
|
(string->number (string c)))]
|
|
|
|
(string->number (string c))))
|
|
|
|
#:result (take ints 8))
|
|
|
|
(define patintss (make-patintss ints))
|
|
|
|
([pidx (in-range phase-count)])
|
|
|
|
(time
|
|
|
|
(for/list ([patints (in-list (make-patintss ints))])
|
|
|
|
(for/fold ([ints ints]
|
|
|
|
(modulo (abs (for/sum ([int (in-list (cons 0 ints))] ; cons 0 to burn off first patint
|
|
|
|
#:result (take ints 8))
|
|
|
|
[patint (in-cycle patints)])
|
|
|
|
([pidx (in-range phase-count)])
|
|
|
|
(* int patint))) 10))))
|
|
|
|
(for/list ([patints (in-list patintss)])
|
|
|
|
|
|
|
|
(modulo (abs (for/sum ([int (in-list (cons 0 ints))] ; cons 0 to burn off first patint
|
|
|
|
|
|
|
|
[patint (in-cycle patints)])
|
|
|
|
|
|
|
|
(* int patint))) 10)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(check-equal? (fft "80871224585914546619083218645595" 100) '(2 4 1 7 6 1 7 6))
|
|
|
|
(check-equal? (fft "80871224585914546619083218645595" 100) '(2 4 1 7 6 1 7 6))
|
|
|
|