Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9178523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:34:19+00:00 2026-06-17T17:34:19+00:00

Imagine a simplified example of a block of blocks containing words: samples: [ [a

  • 0

Imagine a simplified example of a block of blocks containing words:

samples: [
    [a a c a]
    [a a c b]
    [b a c a]
    [c a c b]
    [c c c c]
]

Each block needs to be [c c c c]. So if a value is 'a, it is changed to 'b. If a value is 'b, it is changed to 'c. If a value is 'c, we print "C" and move on:

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")
        ]
    ]
]

In Rebol 2, this works as expected:

Sample 1 - CCCC
Sample 2 - CCCC
Sample 3 - CCCC
Sample 4 - CCCC
Sample 5 - CCCC

But Rebol 3 seems to have a problem (bug?):

Sample 1 - 
Sample 2 - 
Sample 3 - 
Sample 4 - C
Sample 5 - CCCC

I don’t know if it’s related, but a Rebol Wikibook containing a list of changes to parse between Rebol 2 and Rebol 3 says this:

SOME subrule – to prevent unwanted infinite loops in R3 this rule stops also when the subrule matches the input but does not advance it

(Note: This simplified example provided by @rgchris in StackOverflow chat, repeated here to better preserve "institutional knowledge" and permit updating.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:34:20+00:00Added an answer on June 17, 2026 at 5:34 pm

    If it does not actually matter whether you use ANY (0..n) or SOME (1..n), as is the case in your example, you can use WHILE in R3. WHILE basically matches R2’s ANY:

    >> blk: [a a c a]
    
    >> parse blk [while [s: 'a (change s 'b) :s | s: 'b (change s 'c) :s | 'c]]
    == true
    
    >> blk
    == [c c c c]
    

    Alternatively, if that doesn’t suffice because you really need SOME semantics, you could rewrite SOME using more basic primitives. Instead of rule: [some subrule] you can use rule: [subrule opt rule]:

     >> blk: [a a c a]
    
     >> subrule: [s: 'a (change s 'b) :s | s: 'b (change s 'c) :s | 'c]     
     >> parse blk rule: [subrule opt rule]
     == true
    
     >> blk
     == [c c c c]
    

    However, that might make you hit some PARSE limits which you won’t hit with the original SOME (especially in R2).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine you live in very simplified example land - and imagine that you've got
For example, imagine many <div>...</div> blocks within an html page and want to select/find
As a simplified example, imagine that I'm selling widgets. I sell them nationwide (in
Imagine this simplified markup: <div id=header> <!-- Other things.... --> <div id=detail> </div> </div>
Imagine I have the following code (simplified regarding my real context of course): <div
In this simplified scenario, I have a model called Post Each post has a
I typed this simplified example without the benefit of an IDE so forgive any
I've defined a simple Xtext grammar which looks like this (simplified): grammar org.xtext.example.mydsl.MyDsl with
Imagine you have several components in your application, each having its own view. While
A simplified example here: I have a game that I am writing in opengl

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.