 
 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 ;
+json.reader kernel make math math.statistics sequences urls
+namespaces fry ;
 
 IN: reddit
 

PRIVATE>

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

: domain-stats ( domain -- stats )


PRIVATE>

: get-subreddit ( subreddit -- data )
    "http://api.reddit.com/r/%s" sprintf json-page ;

: user-links ( username -- stories )
    (user) data>> [ story? ] filter [ url>> ] map ;

