mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Fix improper `@result' usage.
This commit is contained in:
parent
af40357bc9
commit
fab8ab3113
1 changed files with 71 additions and 71 deletions
|
@ -86,17 +86,17 @@ by the author.
|
||||||
|
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Jump Start::
|
* Jump Start::
|
||||||
* Introduction::
|
* Introduction::
|
||||||
* Using Guile to program in Scheme::
|
* Using Guile to program in Scheme::
|
||||||
* Guile in a Library::
|
* Guile in a Library::
|
||||||
* Regular Expression Support::
|
* Regular Expression Support::
|
||||||
* UNIX System Programming::
|
* UNIX System Programming::
|
||||||
* Where to find more Guile/Scheme resources::
|
* Where to find more Guile/Scheme resources::
|
||||||
* Concept Index::
|
* Concept Index::
|
||||||
* Procedure and Macro Index::
|
* Procedure and Macro Index::
|
||||||
* Variable Index::
|
* Variable Index::
|
||||||
* Type Index::
|
* Type Index::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Jump Start
|
@node Jump Start
|
||||||
|
@ -173,9 +173,9 @@ that can be used along with Scheme (for now just @emph{ctax} and
|
||||||
|
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* What are scripting and extension languages::
|
* What are scripting and extension languages::
|
||||||
* History of Guile and its motivations::
|
* History of Guile and its motivations::
|
||||||
* How to characterize Guile::
|
* How to characterize Guile::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node What are scripting and extension languages
|
@node What are scripting and extension languages
|
||||||
|
@ -460,41 +460,41 @@ guile> @kbd{(define ls (list 1 2 3 4 5 6 7))}
|
||||||
@result{}
|
@result{}
|
||||||
;; @r{display the list}
|
;; @r{display the list}
|
||||||
guile> @kbd{ls}
|
guile> @kbd{ls}
|
||||||
@result{(1 2 3 4 5 6 7)}
|
@result{} (1 2 3 4 5 6 7)
|
||||||
;; @r{ask if @code{ls} is a vector; @code{#f} means it is not}
|
;; @r{ask if @code{ls} is a vector; @code{#f} means it is not}
|
||||||
guile> @kbd{(vector? ls)}
|
guile> @kbd{(vector? ls)}
|
||||||
@result{#f}
|
@result{} #f
|
||||||
;; @r{ask if @code{ls} is a list; @code{#t} means it is}
|
;; @r{ask if @code{ls} is a list; @code{#t} means it is}
|
||||||
guile> @kbd{(list? ls)}
|
guile> @kbd{(list? ls)}
|
||||||
@result{#t}
|
@result{} #t
|
||||||
;; @r{ask for the length of @code{ls}}
|
;; @r{ask for the length of @code{ls}}
|
||||||
guile> @kbd{(length ls)}
|
guile> @kbd{(length ls)}
|
||||||
@result{7}
|
@result{} 7
|
||||||
;; @r{pick out the first element of the list}
|
;; @r{pick out the first element of the list}
|
||||||
guile> @kbd{(car ls)}
|
guile> @kbd{(car ls)}
|
||||||
@result{1}
|
@result{} 1
|
||||||
;; @r{pick the rest of the list without the first element}
|
;; @r{pick the rest of the list without the first element}
|
||||||
guile> @kbd{(cdr ls)}
|
guile> @kbd{(cdr ls)}
|
||||||
@result{(2 3 4 5 6 7}
|
@result{} (2 3 4 5 6 7)
|
||||||
;; @r{this should pick out the 3rd element of the list}
|
;; @r{this should pick out the 3rd element of the list}
|
||||||
guile> @kbd{(car (cdr (cdr ls)))}
|
guile> @kbd{(car (cdr (cdr ls)))}
|
||||||
@result{3}
|
@result{} 3
|
||||||
;; @r{a shorthand for doing the same thing}
|
;; @r{a shorthand for doing the same thing}
|
||||||
guile> @kbd{(caddr ls)}
|
guile> @kbd{(caddr ls)}
|
||||||
@result{3}
|
@result{} 3
|
||||||
;; @r{append the given list onto @code{ls}, print the result}
|
;; @r{append the given list onto @code{ls}, print the result}
|
||||||
;; @r{@strong{NOTE:} the original list @code{ls} is @emph{not} modified}
|
;; @r{@strong{NOTE:} the original list @code{ls} is @emph{not} modified}
|
||||||
guile> @kbd{(append ls (list 8 9 10))}
|
guile> @kbd{(append ls (list 8 9 10))}
|
||||||
@result{(1 2 3 4 5 6 7 8 9 10)}
|
@result{} (1 2 3 4 5 6 7 8 9 10)
|
||||||
guile> @kbd{(reverse ls)}
|
guile> @kbd{(reverse ls)}
|
||||||
@result{(10 9 8 7 6 5 4 3 2 1)}
|
@result{} (10 9 8 7 6 5 4 3 2 1)
|
||||||
;; @r{ask if 12 is in the list --- it obviously is not}
|
;; @r{ask if 12 is in the list --- it obviously is not}
|
||||||
guile> @kbd{(memq 12 ls)}
|
guile> @kbd{(memq 12 ls)}
|
||||||
@result{#f}
|
@result{} #f
|
||||||
;; @r{ask if 4 is in the list --- returns the list from 4 on.}
|
;; @r{ask if 4 is in the list --- returns the list from 4 on.}
|
||||||
;; @r{Notice that the result will behave as true in conditionals}
|
;; @r{Notice that the result will behave as true in conditionals}
|
||||||
guile> @kbd{(memq 4 ls)}
|
guile> @kbd{(memq 4 ls)}
|
||||||
@result{(4 5 6 7)}
|
@result{} (4 5 6 7)
|
||||||
;; @r{an @code{if} statement using the aforementioned result}
|
;; @r{an @code{if} statement using the aforementioned result}
|
||||||
guile> @kbd{(if (memq 4 ls)
|
guile> @kbd{(if (memq 4 ls)
|
||||||
(display "hey, it's true!\n")
|
(display "hey, it's true!\n")
|
||||||
|
@ -507,43 +507,43 @@ guile> @kbd{(if (memq 12 ls)
|
||||||
@print{dude, it's false}
|
@print{dude, it's false}
|
||||||
@result{}
|
@result{}
|
||||||
guile> @kbd{(memq 4 (reverse ls))}
|
guile> @kbd{(memq 4 (reverse ls))}
|
||||||
@result{(4 3 2 1)}
|
@result{} (4 3 2 1)
|
||||||
;; @r{make a smaller list @code{ls2} to work with}
|
;; @r{make a smaller list @code{ls2} to work with}
|
||||||
guile> @kbd{(define ls2 (list 2 3 4))}
|
guile> @kbd{(define ls2 (list 2 3 4))}
|
||||||
;; @r{make a list in which the function @code{sin} has been}
|
;; @r{make a list in which the function @code{sin} has been}
|
||||||
;; @r{applied to all elements of @code{ls2}}
|
;; @r{applied to all elements of @code{ls2}}
|
||||||
guile> @kbd{(map sin ls2)}
|
guile> @kbd{(map sin ls2)}
|
||||||
@result{(0.909297426825682 0.141120008059867 -0.756802495307928)}
|
@result{} (0.909297426825682 0.141120008059867 -0.756802495307928)
|
||||||
;; @r{make a list in which the squaring function has been}
|
;; @r{make a list in which the squaring function has been}
|
||||||
;; @r{applied to all elements of @code{ls}}
|
;; @r{applied to all elements of @code{ls}}
|
||||||
guile> @kbd{(map (lambda (n) (expt n n)) ls)}
|
guile> @kbd{(map (lambda (n) (expt n n)) ls)}
|
||||||
@result{(1 4 27 256 3125 46656 823543)}
|
@result{} (1 4 27 256 3125 46656 823543)
|
||||||
@end smalllisp
|
@end smalllisp
|
||||||
|
|
||||||
@smalllisp
|
@smalllisp
|
||||||
;; @r{make a vector and bind it to the symbol @code{v}}
|
;; @r{make a vector and bind it to the symbol @code{v}}
|
||||||
guile> @kbd{(define v #(1 2 3 4 5 6 7))}
|
guile> @kbd{(define v #(1 2 3 4 5 6 7))}
|
||||||
guile> @kbd{v}
|
guile> @kbd{v}
|
||||||
@result{#(1 2 3 4 5 6 7)}
|
@result{} #(1 2 3 4 5 6 7)
|
||||||
guile> @kbd{(vector? v)}
|
guile> @kbd{(vector? v)}
|
||||||
@result{#t}
|
@result{} #t
|
||||||
guile> @kbd{(list? v)}
|
guile> @kbd{(list? v)}
|
||||||
@result{#f}
|
@result{} #f
|
||||||
guile> @kbd{(vector-length v)}
|
guile> @kbd{(vector-length v)}
|
||||||
@result{7}
|
@result{} 7
|
||||||
;; @r{vector-ref allows you to pick out elements by index}
|
;; @r{vector-ref allows you to pick out elements by index}
|
||||||
guile> @kbd{(vector-ref v 2)}
|
guile> @kbd{(vector-ref v 2)}
|
||||||
@result{3}
|
@result{} 3
|
||||||
;; @r{play around with the vector: make it into a list, reverse}
|
;; @r{play around with the vector: make it into a list, reverse}
|
||||||
;; @r{the list, go back to a vector and take the second element}
|
;; @r{the list, go back to a vector and take the second element}
|
||||||
guile> @kbd{(vector-ref (list->vector (reverse (vector->list v))) 2)}
|
guile> @kbd{(vector-ref (list->vector (reverse (vector->list v))) 2)}
|
||||||
@result{5}
|
@result{} 5
|
||||||
;; @r{this demonstrates that the entries in a vector do not have}
|
;; @r{this demonstrates that the entries in a vector do not have}
|
||||||
;; @r{to be of uniform type}
|
;; @r{to be of uniform type}
|
||||||
guile> @kbd{(vector-set! v 4 "hi there")}
|
guile> @kbd{(vector-set! v 4 "hi there")}
|
||||||
@result{"hi there"}
|
@result{} "hi there"
|
||||||
guile> @kbd{v}
|
guile> @kbd{v}
|
||||||
@result{#(1 2 3 4 "hi there" 6 7)}
|
@result{} #(1 2 3 4 "hi there" 6 7)
|
||||||
@end smalllisp
|
@end smalllisp
|
||||||
|
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ Here are some typical examples of using recursion to process a list.
|
||||||
l
|
l
|
||||||
(append (my-reverse (cdr l)) (list (car l)))))
|
(append (my-reverse (cdr l)) (list (car l)))))
|
||||||
(my-reverse '(27 32 33 40))
|
(my-reverse '(27 32 33 40))
|
||||||
@result{(40 33 32 27)}
|
@result{} (40 33 32 27)
|
||||||
@end smalllisp
|
@end smalllisp
|
||||||
|
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ This could be invoked with @code{(process-matrix m sin)} or
|
||||||
|
|
||||||
@smalllisp
|
@smalllisp
|
||||||
(process-matrix m (lambda (x) (* x x)))
|
(process-matrix m (lambda (x) (* x x)))
|
||||||
@result{((49 4 1 9 4 64 25 9 36) (16 1 1 1 9 64 81 64 1) (25 25 16 64 1 64 4 4 16))}
|
@result{} ((49 4 1 9 4 64 25 9 36) (16 1 1 1 9 64 81 64 1) (25 25 16 64 1 64 4 4 16))
|
||||||
@end smalllisp
|
@end smalllisp
|
||||||
|
|
||||||
To print a representation of the matrix, we could define a generalized
|
To print a representation of the matrix, we could define a generalized
|
||||||
|
@ -715,39 +715,39 @@ creates:
|
||||||
|
|
||||||
;; @r{retrieve the x and y coordinates}
|
;; @r{retrieve the x and y coordinates}
|
||||||
((c 'x))
|
((c 'x))
|
||||||
@result{0}
|
@result{} 0
|
||||||
((c 'y))
|
((c 'y))
|
||||||
@result{0}
|
@result{} 0
|
||||||
;; @r{change the x coordinate}
|
;; @r{change the x coordinate}
|
||||||
((c 'set-x!) 5)
|
((c 'set-x!) 5)
|
||||||
@result{5}
|
@result{} 5
|
||||||
((c 'x))
|
((c 'x))
|
||||||
@result{5}
|
@result{} 5
|
||||||
;; @r{change the color}
|
;; @r{change the color}
|
||||||
((c 'color))
|
((c 'color))
|
||||||
@result{"red"}
|
@result{} "red"
|
||||||
((c 'set-color!) "green")
|
((c 'set-color!) "green")
|
||||||
@result{"green"}
|
@result{} "green"
|
||||||
((c 'color))
|
((c 'color))
|
||||||
@result{"green"}
|
@result{} "green"
|
||||||
;; @r{now use the next! message to move to the next cell}
|
;; @r{now use the next! message to move to the next cell}
|
||||||
((c 'next!))
|
((c 'next!))
|
||||||
@result{(6 . 0)}
|
@result{} (6 . 0)
|
||||||
((c 'x))
|
((c 'x))
|
||||||
@result{6}
|
@result{} 6
|
||||||
((c 'y))
|
((c 'y))
|
||||||
@result{0}
|
@result{} 0
|
||||||
;; @r{now make things wrap around}
|
;; @r{now make things wrap around}
|
||||||
((c 'next!))
|
((c 'next!))
|
||||||
@result{(0 . 1)}
|
@result{} (0 . 1)
|
||||||
((c 'next!))
|
((c 'next!))
|
||||||
@result{(1 . 1)}
|
@result{} (1 . 1)
|
||||||
((c 'next!))
|
((c 'next!))
|
||||||
@result{(2 . 1)}
|
@result{} (2 . 1)
|
||||||
((c 'x))
|
((c 'x))
|
||||||
@result{2}
|
@result{} 2
|
||||||
((c 'y))
|
((c 'y))
|
||||||
@result{1}
|
@result{} 1
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
You will notice that expressions like @code{(c 'next)} return procedures
|
You will notice that expressions like @code{(c 'next)} return procedures
|
||||||
|
@ -775,19 +775,19 @@ type:
|
||||||
@smallexample
|
@smallexample
|
||||||
(define c2 (MAKE-CELL 0 0 "red" 10 7 9))
|
(define c2 (MAKE-CELL 0 0 "red" 10 7 9))
|
||||||
(send c2 'x)
|
(send c2 'x)
|
||||||
@result{0}
|
@result{} 0
|
||||||
(send c2 'set-x! 5)
|
(send c2 'set-x! 5)
|
||||||
@result{5}
|
@result{} 5
|
||||||
(send c2 'color)
|
(send c2 'color)
|
||||||
@result{"red"}
|
@result{} "red"
|
||||||
(send c2 'set-color! "green")
|
(send c2 'set-color! "green")
|
||||||
@result{"green"}
|
@result{} "green"
|
||||||
(send c2 'next!)
|
(send c2 'next!)
|
||||||
@result{(1 . 0)}
|
@result{} (1 . 0)
|
||||||
(send c2 'x)
|
(send c2 'x)
|
||||||
@result{1}
|
@result{} 1
|
||||||
(send c2 'y)
|
(send c2 'y)
|
||||||
@result{0}
|
@result{} 0
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@cindex object-based programming
|
@cindex object-based programming
|
||||||
|
@ -818,11 +818,11 @@ that is done, and how that can be useful.
|
||||||
|
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Two world views::
|
* Two world views::
|
||||||
* What is libguile::
|
* What is libguile::
|
||||||
* How to get started with libguile::
|
* How to get started with libguile::
|
||||||
* More interesting programming with libguile::
|
* More interesting programming with libguile::
|
||||||
* Further examples::
|
* Further examples::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Two world views
|
@node Two world views
|
||||||
|
@ -1051,11 +1051,11 @@ Notice that @code{learn1} uses a Scheme master world, and the C routines
|
||||||
in @code{c_builtins.c} are simply adding new primitives to Scheme.
|
in @code{c_builtins.c} are simply adding new primitives to Scheme.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* learn1.c::
|
* learn1.c::
|
||||||
* c_builtins.h::
|
* c_builtins.h::
|
||||||
* c_builtins.c::
|
* c_builtins.c::
|
||||||
* What learn1 is doing::
|
* What learn1 is doing::
|
||||||
* Compiling and running learn1::
|
* Compiling and running learn1::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node learn1.c
|
@node learn1.c
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue