#!/usr/bin/newlisp

; recursion.lsp - L.M. July 2006-11

(load "postscript.lsp")

; Background
(ps:goto 0 0)
(ps:fill-color 0.1 0.0 0.1)
(ps:shape '((0 792) (90 612) (90 792) (90 612)) true)

(ps:line-color 1 1 0)
(define (rcircle x y r)
	(when (> r 10)
		(rcircle x (add y (div r 2)) (div r 2))
		(rcircle x (sub y (div r 2)) (div r 2))
		(ps:goto x y)
		(ps:circle r)))
		
(rcircle 300 400 350)
	
(define (dragon sign level)
  (if (= 0 level)
   (ps:draw 5)
   (begin
    (dec level)
    (ps:turn (sign 45))
    (dragon - level)
    (ps:turn (* -1 (sign 90)))
    (dragon + level)
    (ps:turn (sign 45)))))

(ps:line-color 1 0 0)
(ps:goto 220 150)
(ps:angle 0)
(dragon + 13)

; Signature
(ps:line-color 0.5 0.5 0.5)
(ps:goto 425 10)
(ps:angle 90)
(ps:font "Helvetica" 10)
(ps:text "made with newLISP and postscript.lsp")

(ps:render)

(exit)



syntax highlighting with newLISP and syntax.cgi