]>
<" and ">for HTML.
function foo( x ) { var tmp = x * x; return tmp + tmp; }
(define (foo x) (let ((tmp (* x x))) (+ tmp tmp)))
(define (response/with-cookie name val xml) (instantiate::http-response-xml (xml xml) (backend (hop-xml-backend)) (header `((Set-Cookie: . ,(format "~a=~s; Max-Age=60" name val))))))
To retrieve a cookie from the server:(define-service (game/submit num) (let ((cookie (http-cookie-get (current-request) "game"))) ...))
..
(define-tag <BROWSER> ((path "/") (attrs) body) (<DIV> attrs ...))
FlipCounter is a small JavaScript libraries for implementing counter with a nice graphical effect. It is described at : http://cnanney.com/journal/code/apple-style-counter-revisited/
The actual JavaScript code is available at: https://bitbucket.org/cnanney/apple-style-flip-counter/raw/fe213d9fa060c3e2bca10be1c2f81b379712a91c/js/flipcounter.min.js
Invoking a JavaScript function within Hop code can be done using two different techniques:
(module my-module ~(js the-imported-js-binding))
~(alert (@ my-js-variable js))
The Hop library function plist->jsobject constructs a JavaScript Object from a Hop plist. Example:
(plist->jsobject '(:value 100 :inc 1))Questions:
MusicBrainz is a popular open music encyclopedia that collects music metadata and makes it available to the public. In addition to provide users with an online access to the database, it also provides a public API. It is described at http://musicbrainz.org/doc/Development.
For that exercise it is recommended to use the Json version of the MusicBrainz API because Hop automatically unmarshall JSON responses into Hop lists. You can also use the XML api and use the Hop xml-parse library function to extract the interesting fields.