from http://docs.factorcode.org/content/article-cookbook-philosophy.html
"If you find yourself wishing you could iterate over the datastack, or
capture the contents of the datastack into a sequence, or push each
element of a sequence onto the datastack, there is almost always a
better way. Use Sequence operations instead."

Why did you want to do these 2 operations ?  We might be able to find
a more idiomatic solution.

Jon

On Wed, Nov 17, 2010 at 6:55 AM, Doug Coleman <doug.cole...@gmail.com> wrote:
> ``[ ] 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
>

------------------------------------------------------------------------------
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

Reply via email to