On Jun 15, 2009, at 4:12 PM, Charles Turner wrote: > In my particular use, I >AM< creating multi-dimensional array > constants for later use, so I think the literal vocabulary would be > appropriate. > > I suppose I could include more of the code that generates the two > source arrays, but it does bring up the question of how to accomplish > this by other means. Time to go back and re-read the vocabulary > pages...
Like you said, you'd need to put all the operands inside your $[ ] block to use literals: CONSTANT: heads $[ { { 1 2 3 } { 1 2 3 } { 1 2 3 } } { 3 2 1 } [ head ] 2map ] The $[ ] syntax kinda sucks for complex expressions like this. You might be better served by using MEMO: words and factoring out the simpler components from which you're building your complex constants. With no parameters, a MEMO: word will run only the first time it's called and cache the result: CONSTANT: bodies { { 1 2 3 } { 1 2 3 } { 1 2 3 } } CONSTANT: head-sizes { 3 2 1 } MEMO: heads ( -- x ) bodies head-sizes [ head ] 2map ; -Joe ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk