# HG changeset patch # User Adam Chlipala # Date 1348929164 14400 # Node ID 923e097e9ba3846b93cdfc5cced612deb53092ba # Parent 7275f59cab611af8a8ab204922a36d390ae8b88a Simplify Reddit example diff -r 7275f59cab61 -r 923e097e9ba3 tests/reddit.ur --- a/tests/reddit.ur Sat Sep 29 10:30:00 2012 -0400 +++ b/tests/reddit.ur Sat Sep 29 10:32:44 2012 -0400 @@ -2,20 +2,17 @@ doc <- Feed.fetch "http://www.reddit.com/?limit=30"; acc <- Feed.app' (Feed.tree (Feed.tagAOR "div" {DataUps = "data-ups", Class = "class"} {Style = "style"}) - (Feed.tagAO "a" {Class = "class", Style = "style", Href = "href"})) + (Feed.tagAOR "a" {Href = "href", Class = "class"} {Style = "style"})) (fn (div, a) (count, list) => - return (case a.Href of - None => (count, list) - | Some link => - if count >= 30 - || not (String.isPrefix {Full = div.Class, Prefix = " thing "}) - || Option.isSome (String.sindex {Haystack = div.Class, Needle = "promoted"}) - || div.Style = Some "display:none" - || a.Class <> Some "title " - || a.Style = Some "display:none" then - (count, list) - else - (count + 1, link :: list))) + return (if count >= 30 + || not (String.isPrefix {Full = div.Class, Prefix = " thing "}) + || Option.isSome (String.sindex {Haystack = div.Class, Needle = "promoted"}) + || div.Style = Some "display:none" + || a.Class <> "title " + || a.Style = Some "display:none" then + (count, list) + else + (count + 1, a.Href :: list))) doc (0, []); return