Skip to content

Commit

Permalink
Merge branch 'racket'
Browse files Browse the repository at this point in the history
  • Loading branch information
jneen committed Jul 19, 2013
2 parents 8076772 + 61faa58 commit e7533ec
Show file tree
Hide file tree
Showing 6 changed files with 902 additions and 2 deletions.
24 changes: 24 additions & 0 deletions lib/rouge/demos/racket
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#lang racket

;; draw a graph of cos and deriv^3(cos)
(require plot)
(define ((deriv f) x)
(/ (- (f x) (f (- x 0.001))) 0.001))
(define (thrice f) (lambda (x) (f (f (f x)))))
(plot (list (function ((thrice deriv) sin) -5 5)
(function cos -5 5 #:color 'blue)))

;; Print the Greek alphabet
(for ([i (in-range 25)])
(displayln
(integer->char
(+ i (char->integer #\u3B1)))))

;; An echo server
(define listener (tcp-listen 12345))
(let echo-server ()
(define-values (in out) (tcp-accept listener))
(thread (λ ()
(copy-port in out)
(close-output-port out)))
(echo-server))
Loading

0 comments on commit e7533ec

Please sign in to comment.