Home   Archive   Permalink



Forall behaviour?

Is this by desing?
    
b: [a b c d e]
forall b []
b
>> [a b c d e] ;it is still is head
    
forall b [if 'c = first b [break]]
b
>> [c d e] ;if we break the loop, it stays at the position where we break

posted by:   Endo     30-May-2010/9:34:26-7:00



'Forall is a mezzanine so you can see, and change, it's design:
    
     source forall
    
You'll see that forall is based on forskip, which is also a mezzanine:
    
     source forskip

posted by:   Nick     30-May-2010/11:22:39-7:00



If you wanted to change forskip's operation, for example, it would be better to create a new function (my-forskip), because there are likely other mezzanine functions built on forskip.

posted by:   Nick     30-May-2010/11:28:12-7:00



Note that older versions of REBOL 2 does not place the index back at the head again in the FORALL function, when it completes the series, while newer ones do. FORALL alters the index of the input function.

posted by:   Henrik     30-May-2010/15:19:33-7:00



Henrik,
    
Not sure if Carl is aware, but the first page that comes up in Google for 'forall still explains the old behavior: http://www.rebol.com/docs/words/wforall.html

posted by:   Nick     30-May-2010/15:34:30-7:00