 
 PRIVATE>
 
-: get-subreddit ( subreddit -- data )
-    "http://api.reddit.com/r/%s" sprintf json-page ;
-
 : user-links ( username -- stories )
-    (user) data>> [ story? ] filter [ url>> ] map ;
+    get-user data>> [ story? ] filter [ url>> ] map ;
 
 : user-comments ( username -- comments )
-    (user) data>> [ comment? ] filter [ body>> ] map ;
+    get-user data>> [ comment? ] filter [ body>> ] map ;
 
 : user-karma ( username -- karma )
-    (about) link_karma>> ;
+    get-user-info link_karma>> ;
 
 : url-score ( url -- score )
-    (url) data>> [ score>> ] map-sum ;
+    get-url-info data>> [ score>> ] map-sum ;
 
 : subreddit-links ( subreddit -- links )
     get-subreddit data>> [ url>> ] map ;

num_reports over_18 permalink saved score selftext selftext_html
subreddit subreddit_id thumbnail title ups url ;

TUPLE: subreddit created created_utc description display_name id
name over18 subscribers title url ;

: parse-data ( assoc -- obj )
    [ "data" swap at ] [ "kind" swap at ] bi {

    ] each-index ;

: domain-stats ( domain -- stats )
    get-domains all-pages [
        created>> 1000 * millis>timestamp year>>
    ] collect-by [ [ score>> ] map-sum ] assoc-map ;
