/trunk/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
- ;;; example.scm
- (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))))
- ;;; example.scm ends here