made sinewave example work

This commit is contained in:
Mustafa 2014-02-15 15:48:21 -08:00
parent be804df673
commit fdfb5558f3
5 changed files with 31 additions and 10 deletions

View file

@ -13,6 +13,7 @@ Licensed under GPL (2 or 3? FIXME)
|#
(require rnrs)
(provide (all-defined-out))
@ -446,7 +447,8 @@ Licensed under GPL (2 or 3? FIXME)
(lookup x (tail l))))))
;; map :: (a -> b) -> [a] -> [b]
(define map1
(define map1 map)
#;(define map1
(lambda (f l)
(if (null? l)
nil
@ -749,7 +751,22 @@ Licensed under GPL (2 or 3? FIXME)
(cons (x) (replicate-m* (- i 1) x)))))
;; data/tree.scm ;;;;;;;;;;;;;;
;; Tree a -> [a]
(define flatten
(letrec ((f (lambda (t r)
(cond ((null? t) r)
((pair? t) (f (head t) (f (tail t) r)))
(else (cons t r))))))
(lambda (t)
(f t nil))))
;; Tree a -> [[a]]
(define levels
(lambda (t)
(if (null? t)
nil
(let ((lr (partition* (compose not pair?) t)))
(cons (fst lr) (levels (concat (snd lr))))))))

View file

@ -12,8 +12,6 @@
)
;; [a] -> int -> [a]
(define extend
(lambda (l n)

View file

@ -1,6 +1,9 @@
#lang racket
(require "../rhs/rhs.rkt" rnrs/bytevectors-6 rnrs/io/ports-6)
(require rnrs
"../rhs/rhs.rkt"
rnrs/bytevectors-6
rnrs/io/ports-6)
(provide (all-defined-out)
put-bytevector
@ -61,4 +64,5 @@
(lambda (f k n)
(let ((v (make-bytevector k 0)))
(f v 0 n (endianness big))
v)))
v)))

View file

@ -36,7 +36,7 @@
(let* ((s (udp*-s u))
(h (udp*-h u))
(p (udp*-p u))
(b (bytes 8192))
(b (make-bytes 8192))
(r (plt:sync/timeout 1.0 (plt:udp-receive!-evt s b))))
(if r
(plt:subbytes b 0 (plt:car r))
@ -78,4 +78,5 @@
(define tcp:close
(lambda (fd)
(close-input-port (tcp*-i fd))
(close-output-port (tcp*-o fd))))
(close-output-port (tcp*-o fd))))

View file

@ -2,7 +2,8 @@
;; from transport.scm ;;;;;;;
(require "bytevector.rkt"
(require rnrs
"bytevector.rkt"
"sosc.rkt"
"ip.rkt")
@ -38,6 +39,6 @@
(let ((p (recv fd)))
(cond
((not p) (error "wait" "timed out"))
((not (string=? (first p) s)) (error "wait" "bad return packet" p s))
((not (string=? (car p) s)) (error "wait" "bad return packet" p s))
(else p)))))