Three Canvas Examples in Weblisp

Kazimir Majorinc
November, 2008.

Christoph Dietze published interesting site Weblisp.net, online intepreter for programming language Weblisp. Currently, the implemented language is minimal but it works well, and even supports simple but cute graphics. (In the meantime, Weblisp.net was discontiuned - K.M. 2013)

(gfx-reset)

(define (P a b r)
(gfx-line a b r r)
(gfx-line a b r (- 100 r))
(gfx-line a b (- 100 r) r)
(gfx-line a b (- 100 r) (- 100 r)))

(define (Q r)
       (P 0 0 r)
       (P 0 100 r)
       (P 100 0 r)
       (P 100 100 r))
(define (drawy r)
        (if (> r 0)
            (begin (Q r)
                   (drawy (- r 1)))))

(drawy 50)
/>
(gfx-reset)
(define (P a b r)
       (gfx-line a b r r)
       (gfx-line a b r (- 100 r))
       (gfx-line a b (- 100 r) r)
       (gfx-line a b (- 100 r) (- 100 r)))

(define (Q r)
       (P 0 0 r)
       (P 0 5000 r)
       (P 100 0 r)
       (P 100 5000 r))

(define (drawy r)
       (if (> r 0)
           (begin (Q r)
                  (drawy (- r 1.01)))))

(drawy 50)
(gfx-reset)

(define (P a b r)
       (gfx-line a b r r)
       (gfx-line a b r (- 100 r))
       (gfx-line a b (- 100 r) r)
       (gfx-line a b (- 100 r) (- 100 r)))

(define (Q r)
       (P 0 0 r)
       (P 0 5000 r)
       (P 5000 0 r)
       (P 5000 5000 r))

(define (drawy r)
       (if (> r 0)
           (begin (Q r)
                  (drawy (- r 1.33333)))))

(drawy 50)