On Aug 24, 2011, at 8:38 PM, Andrew Pennebaker wrote: > $ ./example.factor > Loading /Users/andrew/.factor-rc > The word for-all cannot be executed because it failed to compile > > Cannot apply “input<sequence” to an input parameter of a non-inline word > macro input<sequence
input<sequence is also a macro; it's essentially "firstn" with the "n" determined by stack effect inference on the input quotation. Since it's a macro, that input quotation needs to be statically determinable by the compiler. The compiler isn't smart enough to reach up to the caller's frame without the "inline" annotation on the callee: : foo ( quot -- x ) input<sequence ; inline ! *must* be inline : bar ( -- six ) { 1 2 3 } [ + + ] foo ; The stack is ultimately not a dynamic thing in Factor, and while there are hacks to pretend it is, you'll be happier if you find a more data-structure-oriented approach. You said you had an array of quotations; a better approach would be to iterate over the array, call each quotation with call( -- ) and process the outputs in a single pass, something akin like this: : generate-and-print ( generators -- ) [ call( -- x ) . ] each ; -Joe
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------ EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk