Parse introduction tutorial thingy
[1/5] 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.
[2/5] from: brett:codeconscious at: 9-Nov-2001 2:54
Thanks Anton.
I'll make the changes in the next few days. Especially the input one - gee
whiz I keep forgetting about that function...
Brett.
[3/5] from: brett:codeconscious at: 7-Nov-2001 3:35
I've been meaning to update my parse tutorial for some time. Now I have.
It is only first draft though and I've barely just finished typing it all in
so I'd appreciate comments on whether people find it useful or not. For
those that have been using parse for a while I sincerely doubt you'll find
anything ground shaking. In fact you would probably hate me if I asked you
to read through it all. For those in the process of learning parse, the
target audience, it may provide a fresh point of view. I don't know really.
Let me know if I should rewrite it yet again :-)
http://www.codeconscious.com/rebol/parse-tutorial.html
Thanks
Brett.
[4/5] from: hallvard:ystad:helpinhand at: 7-Nov-2001 10:12
I still consider myself a novice with 'parse, so I'll read it. A very first
comment would be that the sentence "A simple example would be to check that
a post code." seems incomplete.
~H
Brett Handley skrev (Tuesday 06.11.2001, kl. 17.35):
[5/5] from: brett:codeconscious at: 7-Nov-2001 21:25
Thanks Hallvard. I'll look forward to:
parse response [ any comments ]
== true
Brett.