Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Parse introduction tutorial thingy

From: arolls::idatam::com::au at: 8-Nov-2001 16:38

It looks quite good Brett. I reckon the use of Find-result in the following code is a bit confusing: Input: "dog" If Find-result: Find/match input "fox" [ Input: find-result ] Tail? Input I suggest rename 'Find-result to 'position, or 'pos. Input: "dog" If position: Find/match input "fox" [ Input: position ] Tail? Input Find-result sounds too much like a function, but I might be nit-picking. You might want to explain what find/match is doing at this point. In defending "ordinary scripting", I just noticed that you are also setting 'input, which is a built-in value. (I don't think it's bad, maybe it's better to point it out, though.) My defence follows:-) Your version:
>> input: "dog"
== "dog"
>> parse input ["dog" | "cat" | "bird"]
== true My version: input: "dog" foreach animal ["dog" "cat" "bird"][ if found? p: find/match input animal [input: p break] ] tail? input Damn, parse is too powerful for me. That was interesting though. I wonder if there is a more concise way (without using parse, that is:). Spelling errors: Let's say you only want to check that you input contains ... should be -> "your input contains" lets should be -> "let's" short for "lettuce", ah silly me, of course I mean "tomato"... Sometime we really couldn't care less what lies ... should be -> "Sometimes" What are message? should be -> "messages" Grammer: Now parse can this directly as a pattern matching instruction No it can't... :) "can do"? Overall I think it is a very good document. It is structured well with clear sections. Regards, Anton.