Anonymous user
Rosetta Code/Count examples: Difference between revisions
m
→{{header|OCaml}}
Line 268:
-I +netstring netstring.cma -I +netclient netclient.cma -I +xml-light xml-light.cma countex.ml
<lang ocaml>
let reg = Str.regexp_string "'" in
(Str.global_replace reg "%27" s)
Line 294 ⟶ 296:
cmtitle=Category:Programming_Tasks&cmlimit=500&format=xml" in
let
let total = ref 0 in
Line 303 ⟶ 304:
| Xml.Element ("cm", attrs, _) ->
let _title = List.assoc "title" attrs in
let title = repl_quote (repl_space _title) in
▲ let title = repl_quote title in
let url = "http://www.rosettacode.org/w/index.php?title="^ title ^"&action=raw" in
let
Printf.printf "%s: %d\n%!" _title n;
total := n + !total;
|