--- In OSCAR-PROJECT@y..., "Andrew Martin" <Al.Bri@x> wrote:
> marrowmilo wrote:
> > Revised -Rebol Coded/ Diagram
> >
> > |
> > | foreach
> > | example
> > | colors ->
> > | | [if parse
> > | | example
> > | | [to "pink"
> > | | to end]->
> > | | -
> > | | print
> > | | example]]
> > | | ->
>
> That seems awfully time consuming. What's wrong with simply writing:
>
> foreach Color Colors [
> if parse Color [
> to "pink" to end
> ][
> print Color
> ]
> ]
> ?
>
> Note that I've Title-Cased the important words; changed
your 'example to
> 'Color to better reflect the Many contents of 'Colors and the
single nature
> of 'Color; and used consistent indenting.
>
> I hope that helps!
>
> Andrew Martin
> ICQ: 26227169 http://valley.150m.com/
> -><-
------------------------------------------------
H O W T H E R E B O L S C R I P T W O R K S ?
==================================================
Andrew : Thank you for your reply am now trying pseudcode
to get some understanding of how the script works.
Suggestions would be most welcome from you
and fellow subscribers.
- - - - - - - - - - - - - - - - - -
-----------------------------------------------------
P O S S I B L E P S E U D O C O D E
======================================
{ loop | foreach color in colors }
if [ not end color | true ]
if [color contains " pink" | true ]
print color
{ go to loop }
--------------------------------------------------------
R E B O L
=========
colors: ["sun is red" "a pink rose" "gold coin" "a pink elephant"]
foreach color colors [
if parse color [ to "pink" to end]
[print color]]
------------------------------------------------
>> colors: ["sun is red" "a pink rose" "gold coin" "a pink elephant"]
== ["sun is red" "a pink rose" "gold coin" "a pink elephant"]
>> foreach color colors [
[ if parse color [ to "pink" to end]
[ [print color]]
a pink rose
a pink elephant
>>
-------------------------------------------------
foreach Color Colors [
if parse Color [
to "pink" to end
][
print Color
]
]
------------------------------------------------
H O W T H E R E B O L S C R I P T W O R K S ?
==================================================
s o m e
a l t e r n a t i v e s
p o s s i b i l i t i e s
c h o i c e s
================================================
"a pink rose"
"pink" length (6 less 2)
" start 2nd pass
a - p i false
- p i n false
p i n k true
i n k -
n k - r
k - r o
- r o s
r o s e
" end 2nd pass
---------------------------------------------------------
ANY SUGGESTIONS MOST WELCOME
TONY MARROW