aboutsummaryrefslogtreecommitdiff
path: root/Examples/guile/simple/runme.scm
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2019-10-08 15:48:26 -0700
committerHaibo Huang <hhb@google.com>2019-11-14 22:14:23 +0000
commit80b4251e302efb18c145a4786249d695397ed42a (patch)
tree12b9dec2513f7caa92e7835bc17ab16ae5635df6 /Examples/guile/simple/runme.scm
parent189852d8cdfd5863c52ec7aa73affd926c5a3f43 (diff)
parent1e36f51346d95f8b9848e682c2eb986e9cb9b4f4 (diff)
downloadswig-80b4251e302efb18c145a4786249d695397ed42a.tar.gz
Upgrade swig to 'rel-4.0.1'llvm-r383902b
Also run autogen.sh to generate configure files. Exempt-From-Owner-Approval: add myself to owners Change-Id: I391aa20428836ae74dab8c8427627ca4dbc8ecf4
Diffstat (limited to 'Examples/guile/simple/runme.scm')
-rw-r--r--Examples/guile/simple/runme.scm28
1 files changed, 12 insertions, 16 deletions
diff --git a/Examples/guile/simple/runme.scm b/Examples/guile/simple/runme.scm
index c3fd0b41f..ccd755701 100644
--- a/Examples/guile/simple/runme.scm
+++ b/Examples/guile/simple/runme.scm
@@ -3,24 +3,20 @@
(for-each display args)
(newline))
-(mdisplay-newline (get-time) "My variable = " (My-variable))
+; Call our gcd() function
-(do ((i 0 (1+ i)))
- ((= 14 i))
- (mdisplay-newline i " factorial is " (fact i)))
+(define x 42)
+(define y 105)
+(define g (gcd x y))
+(mdisplay-newline "The gcd of " x " and " y " is " g)
-(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))))
+; Manipulate the Foo global variable
-(mods 1 150 1 150)
+; Output its current value
+(mdisplay-newline "Foo = " (Foo))
-(mdisplay-newline "My-variable = " (My-variable))
-
-(exit (and (= 1932053504 (fact 13))
- (= 745470.0 (My-variable))))
+; Change its value
+(Foo 3.1415926)
+; See if the change took effect
+(mdisplay-newline "Foo = " (Foo))