一段guile脚本程序,基本就是打印一个hello world,然后算个阶乘。
#!/usr/bin/guile \
-s
!#
(begin
(newline)
(display "hello world")
(newline))
(define (factorial n)
(fact-iter 1 1 n))
(define (fact-iter product counter max-count)
(if (> counter max-count)
product
(fact-iter (* counter product)
(+ counter 1)
max-count)))
(display (factorial 100))
(newline)
(newline)