civodul pushed a commit to branch wip-build-systems-gexp in repository guix.
commit 5fd352c5199ed2f6b038158f7d7b66851f41f476 Author: Ludovic Courtès <[email protected]> Date: Sat Apr 4 17:58:41 2015 +0200 monads: Micro-optimize 'foldm'. * guix/monads.scm (foldm): Hoist 'monad-bind' and 'monad-return' calls outside of the loop. Use explicit >>= instead of 'mlet*', and explicit return instead of 'with-monad' + 'return'. --- guix/monads.scm | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/guix/monads.scm b/guix/monads.scm index 61cd533..8eb775f 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -266,7 +266,9 @@ MONAD---i.e., return a monadic function in MONAD." (foldm %state-monad (lift2 cons %state-monad) '() '(a b c)) => '(c b a) ;monadic " - (with-monad monad + ;; Hoist access to MONAD's 'bind' and 'return' fields outside of the loop. + (let ((>>= (monad-bind monad)) + (return (monad-return monad))) (let loop ((lst lst) (result init)) (match lst
