523 |
guile> @kbd{(append ls (list 8 9 10))} |
guile> @kbd{(append ls (list 8 9 10))} |
524 |
@result{} (1 2 3 4 5 6 7 8 9 10) |
@result{} (1 2 3 4 5 6 7 8 9 10) |
525 |
guile> @kbd{(reverse ls)} |
guile> @kbd{(reverse ls)} |
526 |
@result{} (10 9 8 7 6 5 4 3 2 1) |
@result{} (7 6 5 4 3 2 1) |
527 |
;; @r{ask if 12 is in the list --- it obviously is not} |
;; @r{ask if 12 is in the list --- it obviously is not} |
528 |
guile> @kbd{(memq 12 ls)} |
guile> @kbd{(memq 12 ls)} |
529 |
@result{} #f |
@result{} #f |
552 |
@result{} (0.909297426825682 0.141120008059867 -0.756802495307928) |
@result{} (0.909297426825682 0.141120008059867 -0.756802495307928) |
553 |
;; @r{make a list in which the squaring function has been} |
;; @r{make a list in which the squaring function has been} |
554 |
;; @r{applied to all elements of @code{ls}} |
;; @r{applied to all elements of @code{ls}} |
555 |
guile> @kbd{(map (lambda (n) (expt n n)) ls)} |
guile> @kbd{(map (lambda (n) (* n n)) ls)} |
556 |
@result{} (1 4 27 256 3125 46656 823543) |
@result{} (1 4 9 16 25 36 49) |
557 |
@end smalllisp |
@end smalllisp |
558 |
|
|
559 |
@smalllisp |
@smalllisp |