2005-07-16 22:16:18 -04:00
|
|
|
! Copyright (C) 2005 Slava Pestov.
|
|
|
|
|
! See http://factor.sf.net/license.txt for BSD license.
|
|
|
|
|
IN: sequences
|
2005-08-14 02:08:11 -04:00
|
|
|
USING: generic kernel lists strings ;
|
2005-07-16 22:16:18 -04:00
|
|
|
|
|
|
|
|
G: tree-each ( obj quot -- | quot: elt -- )
|
2005-08-22 15:33:18 -04:00
|
|
|
[ over ] standard-combination ; inline
|
2005-07-16 22:16:18 -04:00
|
|
|
|
|
|
|
|
: tree-each-with ( obj vector quot -- )
|
|
|
|
|
swap [ with ] tree-each 2drop ; inline
|
|
|
|
|
|
|
|
|
|
M: object tree-each call ;
|
|
|
|
|
|
|
|
|
|
M: sequence tree-each swap [ swap tree-each ] each-with ;
|
|
|
|
|
|
2005-08-14 02:08:11 -04:00
|
|
|
M: string tree-each call ;
|
|
|
|
|
|
2005-07-16 22:16:18 -04:00
|
|
|
M: cons tree-each ( cons quot -- )
|
|
|
|
|
>r uncons r> tuck >r >r tree-each r> r> tree-each ;
|