You're using the datastack as a data structure. That's like calling a
varargs function in C -- in your case, loop could consume any number
of elements on the stack.

The implementation of the listener doesn't restrict code like this,
but the compiler does. You have to know how many arguments from the
datastack will be used at every point in your program.

If you wanted your loop to stop when something was equal to 5, you
could use find on an array:

{ 1 5 4 3 2 } [ 5 = ] find

Also, what Joe said.

Doug

On Fri, Mar 2, 2012 at 1:32 PM, Arkady Rost <arkr...@gmail.com> wrote:
> Hi!
> Today I was trying to write some factor code and it turned out that I can
> write such code:
> 1 5 4 3 2 [ 5 = not ] loop
> It works and produces stack with one element 1. I expect that at least I
> would have a warning because loop word takes quotation with ( ... -- ... ? )
> stack effect. In the example I use quotation with ( x -- x ) stack effect.
> So what I am missing?
>
> Cheers,
>    Arkady Rost
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to