More efficient branch? word

db4
Slava Pestov 2008-07-27 22:45:46 -05:00
parent 74197538f5
commit 9cc761d899
1 changed files with 6 additions and 4 deletions

View File

@ -5,10 +5,12 @@ IN: sequences.deep
! All traversal goes in postorder
: branch? ( object -- ? )
dup sequence? [
dup string? swap number? or not
] [ drop f ] if ;
GENERIC: branch? ( object -- ? )
M: sequence branch? drop t ;
M: integer branch? drop f ;
M: string branch? drop f ;
M: object branch? drop f ;
: deep-each ( obj quot: ( elt -- ) -- )
[ call ] 2keep over branch?