SHARE
TWEET

Untitled

a guest Nov 19th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #lang racket
  2. (define (car-flot f) ;;TODO: USE OR REMOVE
  3. (car f))
  4. (define (cdr-flot f)
  5. (force (cdr f)))
  6. (define flot-null null)
  7. (define (flot-null? f)
  8. (null? f))
  9. (define-syntax consflot
  10. (syntax-rules ()
  11. ((consflot a b) (cons a (delay b)))))
  12.  
  13.  
  14.  
  15. (define (gen-signal a b dt c)
  16.   (gen-signal_inter a b dt c 0)
  17.   )
  18.  
  19. (define (gen-signal_inter a b dt c step)
  20.  (letrec (
  21.     [signal (lambda(x) (* a (sin (+ c (* b (* x dt))))))]
  22.     [flot (consflot (signal step) (gen-signal_inter a b dt c (+ step 1)))]
  23.     ) flot))
  24.  
  25. (define flot1 (gen-signal 1 1 0.5 0))
  26.  
  27.  
  28. (define (flot->liste n flot)
  29.   (flot->liste_inter 0 n flot)
  30.   )
  31.  
  32. (define (flot->liste_inter i n flot)
  33.   (
  34.    if (= i n) '()
  35.        (cons (car-flot flot) (flot->liste_inter (+ i 1) n (cdr-flot flot)))
  36.    
  37.   ))
  38.  
  39. (flot->liste 10 flot1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top