factor/library/collections/tree-each.factor

20 lines
522 B
Factor
Raw Normal View History

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
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 ;
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 ;