Newbie problem
[1/6] from: kpeters:vu-ware at: 2-Feb-2005 12:04
Hi all,
in my script below i would expect cururl to have a different value for each iteration.
It does, however, retain its =A0value from the first iteration.
I vaguely remember there being a newbie trap because of some Rebol feature but can't
for the life of me not remember where ....
Anyone can help me fix this script?
Thanks in advance,
Kai
rebol[]
cats: load %/c/farm/cats.csv
baseurl:
http://protect-the-innocent.net/recherches/standard.php?zyp_id=0&Zip_City=kelowna&Zip_Displayed=100&Zip_InClientsList=1
&Zip_Langue=en&Zip_Page=1&Zip_Produit=@&Zip_Scope=1&Zip_StartPoint=0&Zip_Source=1&Zip_Type=cat&laville=ke
lowna&Zip_Prov=BC&
foreach cat cats [
=A0 cururl: replace baseurl "@" cat
=A0 fname: =A0join %/c/farm/level1/ cat
; print cururl
=A0 write fname read cururl
]
[2/6] from: tomc::darkwing::uoregon::edu at: 2-Feb-2005 12:10
Hi Kai
we wont know what you get from
cats: load %/c/farm/cats.csv
so it will be difficult to speculate
On Wed, 2 Feb 2005, Kai Peters wrote:
[3/6] from: carl::cybercraft::co::nz at: 3-Feb-2005 1:04
Hi Kai,
The end-of-line characters (or whatever they are - yes RT - bring back Selma!), make
your script a bit hard to decipher, but the newbie trap you're thinking of may be that
you need a COPY before the value you're trying to access.
-- Carl Read.
On Wednesday, 2-February-2005 at 12:04 Kai Peters wrote,
[4/6] from: volker:nitsch::gmail at: 3-Feb-2005 6:40
As Carl said, it should be the copy.
foreach cat cats [
cururl: replace baseurl "@" cat
fname: join %/c/farm/level1/ cat
; print cururl ;<-good idea :)
print baseurl ;<- try that too ;)
write fname read cururl
]
You will find baseurl changes the first time. because 'replace does
not copy. and then there is no more "@" to replace.
cururl: replace COPY baseurl "@" cat
On Wed, 2 Feb 2005 12:04:00 -0800, Kai Peters <[kpeters--vu-ware--com]> wrote:
> Hi all,
> in my script below i would expect cururl to have a different value for each
<<quoted lines omitted: 21>>
> To unsubscribe from the list, just send an email to rebol-request
> at rebol.com with unsubscribe as the subject.
--
-Volker
Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem.
David
Wheeler
[5/6] from: kpeters-vu:ware at: 3-Feb-2005 9:11
(Repost - sent the first one out 16 hours ago only to not see it again...)
Thanks guys!
REBOL leaves me breathless - just about everything is at least 10 times simpler and faster
than I typically imagine...
Here's my final question:
The script below finds every *first* occurrence per file - how do I make it find *multiple*
occurrences?
Also, if anyone sees parts of my code that could be improved upon, please do not hesitate
to teach
me a lesson or two - thanks!
Kai
rebol[]
levelone: %/c/arm/level1/
linkfile: %/c/arm/level2/links
files: =A0 =A0read levelone
foreach file files [
=A0 page: read join levelone file
=A0 text: copy ""
=A0 parse/all page [thru {: ViewClient('} copy text to {','info');">} ]
=A0 l: length? text
=A0 either l = 10 [ write/append/lines linkfile mold copy/part text 12 ] [ print l ]
=A0 print file
]
[6/6] from: kpeters-vu:ware at: 2-Feb-2005 12:20
No more help required: Just found it myself - thanks!
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted