next up previous contents
Next: Libraries Up: Iteration Previous: Iteration

operate

The operate function takes as its arguments a set, an operator, and possibly additional arguments. It returns a new set which is the result of the parallel evaluation of every member of the original set using the operator.

(define operate
(function sset
((a sset) (b procedure) . c )
(letrec ((internal-ordered
(lambda (vector index length)
(if (< index length)
(union (apply
b
(cons a
(cons (vector-ref vector index)
(cons index c))))
(internal-ordered
vector (+ 1 index) length))
(ordered ))))
(internal-not
(lambda (elements operation)
(if (null? elements)
(set)
(union (apply operation
(cons a
(cons (car elements)
(cons -1 c))))
(internal-not (cdr elements) operation))))))
(if (ordered? a)
(internal-ordered
(cadr a) 0 (vector-length (cadr a)))
(internal-not (cdr a) b)))))

The synchronize statement takes a thunk (a procedure of no arguments) and evaluates the thunk in a synchronized (thread-safe) procedure.

(define
(synchronize thunk)
((primitive-static-method
<sol.java.Synchronized> "apply0" <Object> (<gnu.mapping.Procedure0>))
thunk))

(define
(get-current-environment)
((primitive-static-method
<gnu.mapping.Environment> "getCurrent" <gnu.mapping.Environment> ())))

(defmacro include (sourcefile)
(if (in? sourcefile sstring)
`(load ,(string-append "/mas/disks/acg2/u2/rich/projects/sol" "/" sourcefile))
`(error "include: Argument not a string."
(list in? sstring ,sourcefile) '-> #f)))



Richard W. DeVaul
1998-12-07