Hello, There's a word called 'flatten' which flattens sequences.
Here's the implementation of 'flatten' from sequences.deep : ---------------------------------------------------------------------- : deep-each ( obj quot -- ) [ call ] 2keep over branch? [ [ deep-each ] curry each ] [ 2drop ] if ; inline : deep-subset ( obj quot -- seq ) over >r pusher >r deep-each r> r> dup branch? [ like ] [ drop ] if ; inline : flatten ( obj -- seq ) [ branch? not ] deep-subset ; ---------------------------------------------------------------------- Here's another version of flatten. One difference is that it uses a 'push' with effect ( vec obj -- vec ). It also doesn't maintain the type of the sequences. ---------------------------------------------------------------------- : push-or-transfer ( vec obj -- vec ) dup branch? [ transfer ] [ push ] if ; : transfer ( vec seq -- vec ) [ push-or-transfer ] each ; : flatten ( seq -- seq ) [ length <vector> ] [ ] bi transfer ; ---------------------------------------------------------------------- Ed ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk