manpagez: man pages & more
info guile-tut
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.5 Compiling and running learn1

 
gcc -g -c learn1.c -o learn1.o
gcc -g -c c_builtins.c -o c_builtins.o
gcc -o learn1 learn1.o c_builtins.o -lguile -lm

If you run learn1, it will prompt you for a one-line Scheme expression, just as learn0 did. The difference is that you can use the new C builtin procedures (c-factorial, c-sin, v-t).

 
<shell-prompt> ./learn1
welcome to Guile
hello Guile
learn1> (display (c-factorial 6))
720
learn1> (display (c-factorial 20))
2192834560
learn1> (display (c-factorial 100))
0
learn1> (display (c-sin 1.5))
0.997494986604054
learn1> (display (v-t 10))
requested length for vector: 10
#(0.0 0.0 1.9 0.0 0.0 0.0 0.0 0.0 0.0 0.0)
learn1> (display (v-t 15))
requested length for vector: 15
#(0.0 0.0 1.9 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)
learn1> (quit)
<shell-prompt>

As you see, taking (c-factorial 100) does not use bignumbers and returns a bogus answer.


© manpagez.com 2000-2024
Individual documents may contain additional copyright information.