Home   Archive   Permalink



not implemented yet? /any, /with in find and select function?

How does find/any and find/with work? How can one specify wildcard characters and embed them in a rule?

posted by:   R       16-Feb-2014/7:34:52-8:00



probe find/any "here is a string" "s?r"
none

posted by:   R       16-Feb-2014/7:36:32-8:00



You are looking for PARSE functionality.

posted by:   A       16-Feb-2014/7:51:07-8:00



/any and /with are only implemented in R2. You can use 'parse or even a 'repeat loop:
    
R E B O L []
x: "here is a string"
repeat i length? x [
     if all [
         #"s" = pick x i
         #"r" = pick x (i + 2)
     ] [print at x i break]    
]
halt

posted by:   Nick       16-Feb-2014/12:34:39-8:00



(parse will always be fastest)

posted by:   Nick       16-Feb-2014/13:02:44-8:00



Thx. By the way, is there a place which summarizes all refinements not implemented yet? Right now I am learning from the Quick Reference Card of R3 on the official site. It seems that only some of the problems are marked in the document, whereas others are not.

posted by:   R       16-Feb-2014/23:31:50-8:00



I haven't seen any such summary, but I don't think there are a huge number of missing refinements in R3. I happened to come across the missing 'find/any refinement while testing code examples for http://learnrebol.com . The 'ask/hide example was also something I bumped into previously.
    
I did do this http://rebolforum.com/index.cgi?f=printtopic&permalink=Nick7-Jan-2014/11:07:12-8:00&archiveflag=new to help others get a start on words which are different between R2-R3, but that won't help with these type of refinements, because the refinements we've come across are actually defined in the functions, but they are simply not implemented. So they show up as existing by any automated script which may compare available refinement options...
    
We could start a page here if the list grows, and provide alternative code to replace missing options.

posted by:   Nick       17-Feb-2014/0:12:11-8:00



Yeah, I don't think there are many missing refinements either. But they can be quite confusing for beginners like me,because they have the potential to become bugs. Besides, I think it is also good to do some explanation or warning in the official document, for most people will treat them as the most authorative reference.

posted by:   R       18-Feb-2014/4:30:33-8:00



Besides, there also seems to be a problem for the argument of /part refinement. For instance, the /part refinement of 'find is explained as follows:
    
/part - Limits the search to a given length or position
length [number! series! pair!]
    
But when I try
find/part "abcdefg" "a" 3x2
there is a warning:
    
** Script error: invalid /part count: 3x2
** Where: find
** Near: find/part "abcdefg" "a" 3x2
    
and this seems to goes against the description in the document.


posted by:   R       18-Feb-2014/4:41:53-8:00



R,
    
It looks like what you want to do is accomplished using copy/part:
    
find (copy/part (at "abcdefg" 3) 2) "d"
    
BTW, the find/part examples from the R2 core book do still work in R3:
    
http://www.rebol.com/docs/core23/rebolcore-6.html#section-7.3
    
Your questions here are helpful, and I look forward to more users participating in the same way. It's a perfect example of why having bigger community and better communication infrastructure is so important. Right now, there just aren't many eyes looking at all the details, and those who are, aren't communicating directly with those who are writing answers and making fixes to the details. Right now, the new R3 community needs to prioritize the process of improving the main web sites, so that those who are involved are all working in one official area. As R3 matures, problems with basic bugs like this should be quickly and easily squashed if there are more people using it, and if there is a clear line of communication for everyone involved. Hostilefork mentioned yesterday that Carl is delegating control of rebol.net and rebol.org to the community, and this conversation is motivating me to get more involved :)

posted by:   Nick       18-Feb-2014/5:55:18-8:00



Yeah, we find and report bugs because we know that Rebol is a wonderful language and there are enthusiastic people who are willing to help. For beginners even the smallest issues will cause great difficulty, and maybe that's why they are sensitive to the bugs in the documents :)

posted by:   R       19-Feb-2014/7:50:26-8:00