guile: fix matrix example

- add missing library in link phase
- empty true path () for if is not allowed
This commit is contained in:
Geert Janssens 2013-04-26 16:52:38 +02:00
commit 7b9c302fa1
3 changed files with 20 additions and 14 deletions

View file

@ -12,6 +12,7 @@ build:
TARGET=$(TARGET) \
IFILE=$(IFILE) \
MODULE=$(MODULE) \
LIBS="-lm" \
sub-all
clean:

View file

@ -138,24 +138,28 @@
(set-m m1 i j (+ (get-m m1 i j) (get-m m2 i j)))
(add-two m1 m2 i (+ j 1)))
(add-two m1 m2 (+ i 1) 0))))
(if (null? ML) () (begin
(add-two M (car ML) 0 0)
(add-mat M (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(add-two M (car ML) 0 0)
(add-mat M (cdr ML)))))
(define (cleanup ML)
(if (null? ML) () (begin
(destroy-matrix (car ML))
(cleanup (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(destroy-matrix (car ML))
(cleanup (cdr ML)))))
(define (make-random ML) ; Put random values in them
(if (null? ML) () (begin
(randmat (car ML))
(make-random (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(randmat (car ML))
(make-random (cdr ML)))))
(define (mul-mat m ML)
(if (null? ML) () (begin
(mat-mult m (car ML) m)
(mul-mat m (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(mat-mult m (car ML) m)
(mul-mat m (cdr ML)))))
;;; Now we'll hammer on things a little bit just to make
;;; sure everything works.