diff options
-rw-r--r-- | doc/api/scripting.texi | 6 | ||||
-rw-r--r-- | sly/actor.scm | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/doc/api/scripting.texi b/doc/api/scripting.texi index 299cf0f..77ef734 100644 --- a/doc/api/scripting.texi +++ b/doc/api/scripting.texi @@ -157,6 +157,12 @@ new actor containing the value returned from @var{proc}. The actor's action remains unchanged. @end deffn +@deffn {Scheme Procedure} apply-effects @var{effects} @var{world} +Apply each effect procedure in @var{effects} using @var{world} as an +initial value. Each successive effect is applied with the world +returned by the previous effect. +@end deffn + @node Actions @subsection Actions diff --git a/sly/actor.scm b/sly/actor.scm index 90803e7..b63a66d 100644 --- a/sly/actor.scm +++ b/sly/actor.scm @@ -35,6 +35,7 @@ update-actor actor-filter-update call-with-actor + apply-effects action-lift action-effect-lift @@ -92,6 +93,14 @@ containing the value returned from PROC." (let ((new (proc (actor-ref actor)))) (make-actor new (actor-action actor)))) +(define (apply-effects effects world) + "Apply each effect procedure in EFFECTS using WORLD as an initial +value. Each successive effect is applied with the world returned by +the previous effect." + (fold (lambda (effect world) (effect world)) + world + effects)) + ;;; ;;; Actions |