Note that there are some explanatory texts on larger screens.

plurals
  1. PODifference between Rebol 2 and Rebol 3 when mixing SOME in parse with CHANGE
    primarykey
    data
    text
    <p>Imagine a simplified example of a block of blocks containing words:</p> <pre><code>samples: [ [a a c a] [a a c b] [b a c a] [c a c b] [c c c c] ] </code></pre> <p>Each block needs to be <code>[c c c c]</code>. So if a value is <code>'a</code>, it is changed to <code>'b</code>. If a value is <code>'b</code>, it is changed to <code>'c</code>. If a value is <code>'c</code>, we print "C" and move on:</p> <pre><code>repeat i length? samples [ prin ["^/Sample" i "- "] parse samples/:i [ some [ s: 'a (change s 'b) :s | s: 'b (change s 'c) :s | 'c (prin "C") ] ] ] </code></pre> <p>In Rebol 2, this works as expected: </p> <pre><code>Sample 1 - CCCC Sample 2 - CCCC Sample 3 - CCCC Sample 4 - CCCC Sample 5 - CCCC </code></pre> <p>But Rebol 3 seems to have a problem (bug?):</p> <pre><code>Sample 1 - Sample 2 - Sample 3 - Sample 4 - C Sample 5 - CCCC </code></pre> <p>I don't know if it's related, but a Rebol Wikibook containing a list of <a href="http://en.wikibooks.org/w/index.php?title=REBOL_Programming/Language_Features/Parse/Parse_expressions&amp;stable=0#Differences_between_R2_and_R3_parsing" rel="nofollow">changes to parse between Rebol 2 and Rebol 3</a> says this:</p> <blockquote> <p>SOME subrule - to prevent unwanted infinite loops in R3 this rule stops also when the subrule matches the input but does not advance it</p> </blockquote> <p><em>(Note: This simplified example <a href="http://chat.stackoverflow.com/transcript/message/7199761#7199761">provided by @rgchris in StackOverflow chat</a>, repeated here to better preserve "institutional knowledge" and permit updating.)</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload