fun request(s) {

Please type a number

{ if (s =~ /^[0-9]+/) else }
} fun response(s) client { var n = stringToInt(s); replaceDocument(

Factorials up to {intToXml(n)}

{ for ((i=i,f=f) <- lookupFactorials(n)) }
{intToXml(i)} {intToXml(f)}
) } fun lookupFactorials(n) server { var db = database "factorials"; var factorials = table "factorials" with (i : Int, f : Int) from db; query { for (row <-- factorials) where (row.i <= n) orderby (row.i) [(i=row.i, f=row.f)] } } fun main() { page <#>{request("")} } main()