French government agency INSEE (
National Institute of Statistics and Economic Studies; http://www.insee.fr),
created in the middle of the 20th century, is in charge of conducting all sorts
of statistical analyses of the population
and economy. INSEE has become an
important open data provider.
Surprisingly, the data might be
endogenous, too. Google’s flu trends
analysis is a remarkable example of
this kind. Google researchers have ob-
served that the number and locales of
search requests about flu is strongly
related to the propagation of the ill-
ness. 2 Google makes this data avail-
able country by country, making it easy
for anyone to implement applications
using these statistics.
Figure 10. Visualizing the flu propagation worldwide.
(module flutrend
(import (gchart "gchart-api- 1.0.*.hz")))
(<HTML>
˜(define sources
(<IMG> :src (google-chart :type ’map :area ’europe)
:onload ˜(when (pair? sources)
(after 300
(lambda ()
(set! this.src (car sources))
(set! sources (cdr sources)))))))
Figure 1: Visualizing the Flu propagation world wide.
Figure 11. Reacting to SMS.
ate a video showing the propagation of
the flu over time. This is mostly a tool-combination problem since all the
hard work can be delegated to external
parties. Thus, the work shown here
consists only of collecting, combining, and reusing all the tools and data
at our disposal. The actual Hop implementation, shown in Figure 10, counts
no more than 15 lines of code.
The application code relies on a
binding that makes the Google Chart
API directly accessible from Hop. This
Web API creates all kinds of charts and
geographical maps, generating images according to the arguments specified on appropriate URLs. This API is
combined with the extraction of flu
statistics. First, image URLs are generated out of statistical values parsed
using a Hop spreadsheet-elements library. Then images generated on the
fly by Google Chart are displayed one
after the other, every 300 milliseconds.
This example shows that new and
deep knowledge might emerge when
the ability to collect, compare, and analyze vast sets of open data is easily accessible. Hop is specifically geared toward this objective, with composition
and reuse as the two central features.
(module androidemo
(library mail phone hopdroid))
(define android (instantiate::androidphone))
(define tts (instantiate::androidtts (phone android)))
(define-service (phone/sms)
(define speak #t)
(add-event-listener! android "sms-received"
(lambda (e::event)
;; function invoked on the server (i.e., the phone)
;; upon sms-reception
(let ((val e.value))
;; broadcast to all clients the reception of the sms
(hop-event-broadcast! "sms" val)
;; speak out the sms content on the phone
(when speak (tts-speak tts (cadr val))))))
;; create two empty HTML elements that will be filled
;; upon SMS reception
(let ((sms-num (<TD>))
(sms-body (<TD>)))
(<HTML>
˜(add-event-listener! server "sms"
;; function invoked on the client (i.e., a web browser)
;; upon reception of the server "sms" event
(lambda (e)
;; insert the calling number in the HTML page
(innerHTML-set! $sms-num (car e.value))
;; insert the SMS content in the HTML page
(innerHTML-set! $sms-body (cadr e.value))))
(<TABLE> (<TR> sms-num sms-body))
(<BUTTON> :onclick ˜(with-hop ($(service () (set! speak (not speak)))))
"mute/speak"))))
Figure 1: Reacting to SMS.
Bigger than the Web
The human Web can be made even
bigger by binding sensors from and
actuators to the physical environment, such as those provided by
smartphone sensors, multimedia
equipment, home or automotive automation equipment, and the countless
other electronic devices that surround
us. However, only the most popular
of these sensors will be natively supported by the next Web browsers. For
example, the incoming versions of
the Firefox and Chrome navigators
have announced support for video
and audio capture; accessing other
remote equipment through browsers
or programmed applications will still
require third-party support. The Hop
philosophy is to migrate the remote
interface facilities to the server, give
the user full Hop programming power
on the associated data, and deliver
results to clients in the standard way
when using browser-based interfaces.
For example, Figure 11 shows how
to implement a Hop application that
integrates features provided by a mo-