Paste: reduce1 / foldl1

Author: tylerg
Mode: factor
Date: Thu, 8 Jan 2009 17:58:54
Plain Text |
! this is analogous to haskell's foldl1
! I find myself wanting this combinator all the time

: reduce1 ( seq quot -- result )
  [ [ rest ] [ first ] bi ] dip
  reduce ;

Annotation: shorter version

Author: slava
Mode: factor
Date: Thu, 8 Jan 2009 19:45:53
Plain Text |
: reduce1 ( seq quot -- result ) [ ] swap map-reduce ; inline

New Annotation

Summary:
Author:
Mode:
Body: