diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-08-18 20:56:02 +0000 |
|---|---|---|
| committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-25 16:59:08 +0000 |
| commit | 9f8a09ed743cedd9547bf0661d518647966ab114 (patch) | |
| tree | 9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/guile/simple/example.scm | |
| download | swig-tarball-master.tar.gz | |
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/guile/simple/example.scm')
| -rw-r--r-- | Examples/guile/simple/example.scm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Examples/guile/simple/example.scm b/Examples/guile/simple/example.scm new file mode 100644 index 0000000..9408b1a --- /dev/null +++ b/Examples/guile/simple/example.scm @@ -0,0 +1,28 @@ +;;; 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 |
