|
codepad
|
|
|
Project:
programmingpraxis
|
|
|
|
|
Recent Pastes:
; lexicographic permutations
(define (next-perm lt? zs)
(if (null? zs) zs
(let next ((xlist (list (car zs))) (ys (cdr zs)))
|
| view (29 lines, 4 lines of output) |
; traveling salesman: brute force
(define (sum xs) (apply + xs))
(define (range . args)
|
| view (112 lines, 2 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 5 lines of output) |
; binary search tree
(define rand
(let* ((a 3141592653) (c 2718281829)
(m (expt 2 35)) (x 5772156649)
|
| view (112 lines, 4 lines of output) |
; binary search tree
(define rand
(let* ((a 3141592653) (c 2718281829)
(m (expt 2 35)) (x 5772156649)
|
| view (112 lines, 1 line of output) |
; <b style="color:#000;background:#ffff66">affine-shift</b> <b style="color:#000;background:#66ffff">cipher</b>
(define (inverse x n)
(let loop ((x (modulo x n)) (a 1))
(cond ((zero? x) (return #f))
|
| view (38 lines, 3 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 4 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 4 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 3 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 4 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 4 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 4 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 4 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 3 lines of output) |
; lexicographic permutations
(define (next-perm lt? zs)
(if (null? zs) zs
(let next ((xlist (list (car zs))) (ys (cdr zs)))
|
| view (29 lines, 4 lines of output) |
; goldbach's conjecture
(define (primes n)
(let* ((max-index (quotient (- n 3) 2))
(v (make-vector (+ 1 max-index) #t)))
|
| view (121 lines, 3 lines of output) |
; goldbach's conjecture
(define (expm b e m)
(define (m* x y) (modulo (* x y) m))
(cond ((zero? e) 1)
|
| view (102 lines, 1 line of output) |
; run-length encoding
(define (compress in-port out-port)
(define (n->char n) (integer->char (+ 64 n)))
(define (show-run prev n)
|
| view (38 lines, 1 line of output) |
; run-length encoding
; This implementation is not IEEE- or R5RS-compliant,
; for the following reasons:
;
|
| view (243 lines, 1 line of output) |