Skip to content

Instantly share code, notes, and snippets.

@PhDP
Last active December 31, 2015 18:49
Show Gist options
  • Save PhDP/8029422 to your computer and use it in GitHub Desktop.
Save PhDP/8029422 to your computer and use it in GitHub Desktop.
Get titles from arXiv's Stat.ML
open System.Xml.Linq
open FSharp.Data
/// Use F#'s awesome type provider to access arXiv's API.
type StatML = XmlProvider<"http://export.arxiv.org/api/query?search_query=stat.ML&start=0&max_results=1000">
/// Request Stat.ML articles from 'a' to 'b'.
let APIReq (a: int) (b: int) =
"http://export.arxiv.org/api/query?search_query=stat.ML&start=" + (string a) + "&max_results=" + (string b)
/// Get titles from 'a' to 'b' (e.g. StatMLTitles 0 1000, StatMLTitles 4247 6381). Store the titles in
/// a set object (sorted automatically).
let StatMLTitles a b =
(Set.empty, StatML.Load(APIReq a b).GetEntries())
||> Array.fold (fun acc e -> Set.add e.Title acc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment