v3.ocaml.org-rescript icon indicating copy to clipboard operation
v3.ocaml.org-rescript copied to clipboard

Consider a more compelling example for the front page

Open yminsky opened this issue 4 years ago • 0 comments

The current front-page example is a nice but impractical finger-exercise. It would be nice to have something more realistic. Here's a kind of example that might be fun, which you could get if you linked in the lambdasoup package:

# let get_hrefs soup =
    Soup.select "a" soup
    |> Soup.to_list
    |> List.map (Soup.R.attribute "href")
  ;;
val get_hrefs : 'a Soup.node -> string list = <fun>
# get_hrefs (Soup.parse {|
     <html><body>
        <a href="https://ocaml.org"> This is a link! </a>
        And here's <a href="https://github.com/ocaml">another one</a>. |});;
- : string list = ["http://ocaml.org"; https://github.com/ocaml"]

I think something like that could be a lot more compelling.

yminsky avatar Feb 05 '22 02:02 yminsky