var results_per_page = 10; fun find(n,c) { var db = database "dictionary"; var wordlist = table "wordlist" with ( word: String, meaning: String ) from db; # take(results_per_page, # drop(results_per_page * (n-1), # for (r <-- wordlist) # where (r.word =~ /^{c}.*/) # orderby (r.word) # [r] # ) # ) var limit = results_per_page; var offset = results_per_page * (n-1); query [limit,offset] { for (r <-- wordlist) where (r.word =~ /^{c}.*/) orderby (r.word) [r] } } fun showPage(n, c) { var title = stringToXml("Results: page " ^^ intToString(n)); page {title}

{title}

{for (result <- find(n, c)) <#>
{stringToXml(result.word)}
{stringToXml(result.meaning)}
}
{if (n <> 1) previous else } next } fun main() { page Dictionary browser

Dictionary browser

} main()