PageRenderTime 19ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/ttn-post-libtool-1-4-3-upgrade/SWIG/Examples/guile/simple/example.scm

#
Lisp | 28 lines | 18 code | 8 blank | 2 comment | 0 complexity | feb01d50957f360a484a1d98d3388a44 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1;;; example.scm
 2
 3(define (mdisplay-newline . args)       ; does guile-1.3.4 have `format #t'?
 4  (for-each display args)
 5  (newline))
 6
 7(mdisplay-newline (get-time) "My variable = " (My-variable))
 8
 9(do ((i 0 (1+ i)))
10    ((= 14 i))
11  (mdisplay-newline i " factorial is " (fact i)))
12
13(define (mods i imax j jmax)
14  (if (< i imax)
15      (if (< j jmax)
16          (begin
17            (My-variable (+ (My-variable) (mod i j)))
18            (mods i imax (+ j 1) jmax))
19          (mods (+ i 1) imax 1 jmax))))
20
21(mods 1 150 1 150)
22
23(mdisplay-newline "My-variable = " (My-variable))
24
25(exit (and (= 1932053504 (fact 13))
26           (= 745470.0 (My-variable))))
27
28;;; example.scm ends here