[ create a new paste ] login | about

Project: programmingpraxis
Language:
Description:
None

Recent Pastes:

Scheme, pasted on Mar 12:
1
2
3
4
5
; 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)
programmingpraxis - Scheme, pasted on Mar 10:
1
2
3
4
5
; traveling salesman: brute force

(define (sum xs) (apply + xs))

(define (range . args)
...
view (112 lines, 2 lines of output)
Scheme, pasted on Mar 6:
1
2
3
4
5
; 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)
programmingpraxis - Scheme, pasted on Mar 4:
1
2
3
4
5
; binary search tree

(define rand
  (let* ((a 3141592653) (c 2718281829)
         (m (expt 2 35)) (x 5772156649)
...
view (112 lines, 4 lines of output)
Scheme, pasted on Mar 4:
1
2
3
4
5
; binary search tree

(define rand
  (let* ((a 3141592653) (c 2718281829)
         (m (expt 2 35)) (x 5772156649)
...
view (112 lines, 1 line of output)
Ruby, pasted on Mar 2:
1
2
3
4
5
; <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)
Scheme, pasted on Mar 2:
1
2
3
4
5
; 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)
Scheme, pasted on Mar 2:
1
2
3
4
5
; 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)
Scheme, pasted on Mar 2:
1
2
3
4
5
; 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)
Scheme, pasted on Mar 2:
1
2
3
4
5
; 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)
Scheme, pasted on Mar 2:
1
2
3
4
5
; 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)
Scheme, pasted on Mar 2:
1
2
3
4
5
; 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)
Scheme, pasted on Mar 2:
1
2
3
4
5
; 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)
Scheme, pasted on Mar 2:
1
2
3
4
5
; 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)
programmingpraxis - Scheme, pasted on Feb 27:
1
2
3
4
5
; 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)
programmingpraxis - Scheme, pasted on Feb 26:
1
2
3
4
5
; 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)
Scheme, pasted on Feb 26:
1
2
3
4
5
; 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)
programmingpraxis - Scheme, pasted on Feb 24:
1
2
3
4
5
; 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)
Scheme, pasted on Feb 24:
1
2
3
4
5
; run-length encoding

; This implementation is not IEEE- or R5RS-compliant,
; for the following reasons:
;
...
view (243 lines, 1 line of output)
Scheme, pasted on Feb 24:
1
2
3
4
5
; 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)