``[ ] each'' won't compile in a Factor word. You can use it in the repl, but even this may chnage in the future if repl expressions are compiled with the optimizing compiler before being executed.
All Factor code should know the stack height difference after a word executes. In this case, the stack height will depend on how many elements are in the array, so you can't know the heights at compile-time. Also, your datastack will overflow if your array is too big. Stick to the narray/firstn macros. Doug On Tue, Nov 16, 2010 at 11:33 PM, Jim mack <j...@less2do.com> wrote: > [ ] each > > On Tue, Nov 16, 2010 at 6:56 PM, Jeff C. Britton <j...@iteris.com> wrote: >> >> Thanks, but now I want to do the reverse. >> Stack Top Some Word New Stack Top >> { 2 4 8 16 32 } ? 32 >> 16 >> 8 >> 4 >> 2 >> >> -----Original Message----- >> From: Chris Double [mailto:chris.dou...@double.co.nz] >> Sent: Tuesday, November 16, 2010 6:01 PM >> To: factor-talk@lists.sourceforge.net >> Subject: Re: [Factor-talk] How do I construct a sequence from values on >> thestack >> >> On Wed, Nov 17, 2010 at 2:56 PM, Jeff C. Britton <j...@iteris.com> wrote: >> > What "word" do I need? >> >> There are worlds like 1array, 2array, 3array and 4array to produce an >> array from that many items on the stack. There is also 'narray' which >> is a generalisation of these for any number. eg: >> >> 2 4 8 16 32 4 narray => { 2 4 8 16 } >> >> Chris. >> -- >> http://www.bluishcoder.co.nz >> >> ------------------------------------------------------------------------ >> ------ >> Beautiful is writing same markup. Internet Explorer 9 supports >> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. >> Spend less time writing and rewriting code and more time creating great >> experiences on the web. Be a part of the beta today >> http://p.sf.net/sfu/msIE9-sfdev2dev >> _______________________________________________ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/factor-talk >> >> >> ------------------------------------------------------------------------------ >> Beautiful is writing same markup. Internet Explorer 9 supports >> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. >> Spend less time writing and rewriting code and more time creating great >> experiences on the web. Be a part of the beta today >> http://p.sf.net/sfu/msIE9-sfdev2dev >> _______________________________________________ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/factor-talk > > > > -- > Jim > "I'm for extending the working Medicare program for our seniors all the way > back to contraception, so Americans can concentrate on living their lives > without fear of changing a job, going bankrupt from deductibles or fighting > HMO bureaucracy." > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today > http://p.sf.net/sfu/msIE9-sfdev2dev > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > > ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk