swig/Examples/guile/simple/runme.scm
William S Fulton d974e9aced Guile examples consistency changes
Use new guile_embedded_run target or guile_run target for running the
examples like the other target languages (for suppressing stdout if run
from top level).

Consistency with other target language file renames: use runme.scm for
scripts and example.i, example.c for example code.

Add class example to examples being tested.
2013-05-09 18:35:18 +01:00

26 lines
632 B
Scheme

(define (mdisplay-newline . args) ; does guile-1.3.4 have `format #t'?
(for-each display args)
(newline))
(mdisplay-newline (get-time) "My variable = " (My-variable))
(do ((i 0 (1+ i)))
((= 14 i))
(mdisplay-newline i " factorial is " (fact i)))
(define (mods i imax j jmax)
(if (< i imax)
(if (< j jmax)
(begin
(My-variable (+ (My-variable) (mod i j)))
(mods i imax (+ j 1) jmax))
(mods (+ i 1) imax 1 jmax))))
(mods 1 150 1 150)
(mdisplay-newline "My-variable = " (My-variable))
(exit (and (= 1932053504 (fact 13))
(= 745470.0 (My-variable))))