Paste: log loader

Author: mk
Mode: factor
Date: Thu, 3 Feb 2011 20:57:26
Plain Text |
! Copyright (C) 2011 Mukhamed Karanashev.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays calendar http.client kernel locals math
math.parser sequences ;
IN: logloader

CONSTANT: BASE-LOG-URL "http://bespin.org/~nef/logs/concatenative/"

: glue ( -- c )
    CHAR: 0 ;

:: cut-seq ( seq n -- seq )
    n seq length < [
        seq n tail*
    ] [
        seq n glue pad-head
    ] if ;

: name ( date -- name )
    [ year>> ] [ month>> ] [ day>> ] tri
    [ number>string 2 cut-seq ] tri@
    3array "." join ;

: last-name ( -- name )
    now name ;

: log-url ( date -- url )
    name BASE-LOG-URL prepend ;

: get-log ( date -- log )
    log-url http-get nip ;

New Annotation

Summary:
Author:
Mode:
Body: