mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 09:10:22 +02:00
* scripts/README, scripts/hello.scm, safe/untrusted.scm,
safe/evil.scm, safe/README, modules/README, modules/main, modules/module-0.scm, modules/module-1.scm, modules/module-2.scm: Minor cleanup. * README: Added intro stuff, restructured a bit. * box-dynamic/README, box-module/README, box/README: Cleanup and restructuring. * box-dynamic-module/box-mixed.scm: New file, demonstrating usage of extension library functionality, but without exporting procedures from the library. Thanks to Thomas Wawrzinek for the idea and example code! * box-dynamic-module/box-module.scm: Add comments, export make-box, box-ref, box-set!. * box-dynamic-module/README: Integrate new module (box-mixed), restructure and cleanup a bit.
This commit is contained in:
parent
4927dd283b
commit
673509f84f
21 changed files with 236 additions and 60 deletions
44
examples/box-dynamic-module/box-mixed.scm
Normal file
44
examples/box-dynamic-module/box-mixed.scm
Normal file
|
@ -0,0 +1,44 @@
|
|||
;;; examples/box-dynamic-module/box-mixed.scm -- Scheme module using some
|
||||
;;; functionality from the shared library libbox-module, but do not
|
||||
;;; export procedures from the module.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; This is the Scheme module box-mixed. It uses some functionality
|
||||
;;; from the shared library libbox-module, but does not export it.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Author: Thomas Wawrzinek
|
||||
;;; Date: 2001-06-08
|
||||
;;; Changed: 2001-06-14 by martin, some commenting, cleanup and integration.
|
||||
|
||||
(define-module (box-mixed))
|
||||
|
||||
;; First, load the library.
|
||||
;;
|
||||
(load-extension "libbox-module" "scm_init_box")
|
||||
|
||||
;; Create a list of boxes, each containing one element from ARGS.
|
||||
;;
|
||||
(define (make-box-list . args)
|
||||
(map (lambda (el)
|
||||
(let ((b (make-box)))
|
||||
(box-set! b el) b))
|
||||
args))
|
||||
|
||||
;; Map the procedure FUNC over all elements of LST, which must be a
|
||||
;; list of boxes. The result is a list of freshly allocated boxes,
|
||||
;; each containing the result of an application of FUNC.
|
||||
(define (box-map func lst)
|
||||
(map (lambda (el)
|
||||
(let ((b (make-box)))
|
||||
(box-set! b (func (box-ref el)))
|
||||
b))
|
||||
lst))
|
||||
|
||||
;; Export the procedures, so that they can be used by others.
|
||||
;;
|
||||
(export make-box-list box-map)
|
||||
|
||||
;;; End of file.
|
Loading…
Add table
Add a link
Reference in a new issue