Jump to content

Yahoo! search interface: Difference between revisions

m
→‎{{header|Tcl}}: remove ugliness in first example
(→‎{{header|Tcl}}: Corrections and improvements)
m (→‎{{header|Tcl}}: remove ugliness in first example)
Line 232:
lappend results [fix $title] [fix $content] [fix $url]
}
 
# set up the call for the next page
returninterp alias {} Nextpage {} [YahooSearch $term $::[incr page]
 
return $results
 
# Ugly; uses global state variable but works with all current Tcl versions
proc Nextpage {term} {
incr ::page
return [YahooSearch $term $::page]
}
 
# Usage: get the first two pages of results
foreach {title content url} [YahooSearch "test"] {
set ::page 1
puts $title
set term "test"
foreach result_set [list [YahooSearch $term] [Nextpage $term]] {
foreach {title content url} $result_set[Nextpage] {
puts $title
}
}</lang>
{{works with|Tcl|8.6}}
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.