 PRIVATE>
 
 : subreddit-top ( subreddit -- )
-    (subreddit) data>> [
+    get-subreddit data>> [
         1 + "%2d. " sprintf write-text {
-            [ title>> write-title nl ]
-            [ "    " write url>> write-url ]
-            [ score>> ]
-            [ num_comments>> ]
+            [ [ title>> ] [ url>> ] bi write-title nl ]
+            [ score>> "    %d points, " sprintf write-text ]
+            [ [ num_comments>> "%d comments" sprintf ] [ story>comments-url ] bi write-link ]
             [
                 created_utc>> unix-time>timestamp now swap time-
-                duration>hours "%d hours ago" sprintf
+                duration>hours ", posted %d hours ago" sprintf write-text
             ]
-            [ author>> ]
+            [ " by " write-text [ author>> ] [ story>author-url ] bi write-link nl nl ]
         } cleave
-        "    %d points, %d comments, posted %s by %s\n\n"
-        sprintf write-text
     ] each-index ;
 
 : domain-stats ( domain -- stats )


USING: accessors assocs calendar classes.tuple colors.constants
colors.hex combinators formatting http.client io io.styles json
json.reader kernel make math math.statistics sequences urls ;

IN: reddit


    "http://api.reddit.com/user/%s/about" sprintf
    http-get nip json> parse-data ;

: (url) ( url -- data )
    "http://api.reddit.com/api/info?url=%s" sprintf json-page ;

