Yahoo! search interface: Difference between revisions

m
(→‎Tcl: Added implementation)
Line 240:
Tcl 8.6 can use its coroutine support to produce an iterator more like that Python code:
<lang tcl>proc yahoo! term {
coroutine yahoo![incr ::yahoo] appyapply {term {
yield [info coroutine]
while 1 {
Line 247:
return -code break
}
foreach {t c u} $resultresults {
yield [dict create title $t content $c url $u]
}
Line 258:
while 1 {
puts [dict get [$it] title]
after 300 ;# Slow the code down... :-)
}</lang>
Anonymous user