[REBOL] Re: "Towers of Hanoi" : Comments please
From: rgombert:essentiel at: 19-Feb-2001 22:02
Thanks Nenad, your comments are of great help for me.
My code is indented, but with tabs... wich have disapeared in the mail.
Sorry, i'll take care about this for next postings.
As you sugest, a next release will be a /View one... but now i don't know
how to make widgets move on a layout : i've just started to learn /Core and
/View. To learn, i'm also writing a webpage checker. The /Core version is
working, and i'm curently "dressing" it with /View. I'll post it here if i'm
not boring you with my scripts.
The actual /Core version stay below... but haven't yet been modified
regarding of Nenad's comments... except for my indentation, that i've tried
to conserve.
REBOL [
Title: "Web Page Change Detector"
File: %checkweb.r
Date: 19-Feb-2001
Purpose: {
Determine if a web pages has changed since it was last checked.
}
Category: [web file net 2]
]
;### Where the script is
script-path: "scripts/"
;### Add a site to check
addsite: func [
/local name url
] [
print "ADDING A WEBPAGE TO THE LIST : "
name: ask "Page name : "
url: make url! ask "Page URL : "
url: make block! append (append (append [] name) url) 0
webdata: append/only webdata url
save make file! reduce [script-path "webs.rdata"] webdata
]
;### LOAD data file
either exists? %webs.rdata [
webdata: load %webs.rdata
][
webdata: make block! []
print "DATAFILE IS NOT ACCESSIBLE... creating one"
addsite
]
;### go to the website - work only within /View
goweb: func [i] [browse pick webdata/:i 2]
;### Do all the checkings
checkweb: func [
/local i changed
/go
][
changed: false
i: make integer! 0
foreach site webdata [
i: i + 1
page-sum: checksum read site/2
prin ["[" i "]> " site/1]
either page-sum = site/3 [
print " cheked."
][
poke site 3 page-sum
print [" HAS CHANGED (" site/2 ")"]
if go [goweb i]
changed: true
]
]
if changed [save make file! reduce [script-path "webs.rdata"] webdata]
print "WEBPAGES CHECK DONE."
]