Jump to content

Rosetta Code/Count examples: Difference between revisions

m
m (→‎{{header|OCaml}}: handle 404)
Line 439:
let f = function
| Xml.Element ("cm", attrs, _) ->
(try
let _title = List.assoc "title" attrs in
let title_title = repl_quoteList.assoc (repl_space"title" _title)attrs in
let title = repl_quote (repl_space _title) in
let url = "http://www.rosettacode.org/w/index.php?title="^ title ^"&action=raw" in
let n = count_ex (http_get url) in
Printf.printf "%s: %d\n%!" _title n;
total Printf.printf "%s:= %d\n%!" +_title !totaln;
total := n + !total;
with Http_client.Http_error (404, _) -> ())
| _ -> ()
in
Cookies help us deliver our services. By using our services, you agree to our use of cookies.