lint cleanups

db4
Doug Coleman 2008-01-12 12:23:34 -10:00
parent 3f7943fb08
commit b6b9e6cc05
7 changed files with 13 additions and 15 deletions

View File

@ -4,7 +4,7 @@
USING: arrays hashtables io io.streams.string kernel math USING: arrays hashtables io io.streams.string kernel math
math.vectors math.functions math.parser namespaces sequences math.vectors math.functions math.parser namespaces sequences
strings tuples system debugger combinators vocabs.loader strings tuples system debugger combinators vocabs.loader
calendar.backend structs alien.c-types ; calendar.backend structs alien.c-types math.vectors ;
IN: calendar IN: calendar
TUPLE: timestamp year month day hour minute second gmt-offset ; TUPLE: timestamp year month day hour minute second gmt-offset ;
@ -186,7 +186,8 @@ M: number +second ( timestamp n -- timestamp )
#! data #! data
tuple-slots tuple-slots
{ 1 12 365.2425 8765.82 525949.2 31556952.0 } { 1 12 365.2425 8765.82 525949.2 31556952.0 }
[ / ] 2map sum ; v/ sum ;
: dt>months ( dt -- x ) dt>years 12 * ; : dt>months ( dt -- x ) dt>years 12 * ;
: dt>days ( dt -- x ) dt>years 365.2425 * ; : dt>days ( dt -- x ) dt>years 365.2425 * ;
: dt>hours ( dt -- x ) dt>years 8765.82 * ; : dt>hours ( dt -- x ) dt>years 8765.82 * ;
@ -235,7 +236,7 @@ M: timestamp <=> ( ts1 ts2 -- n )
unix-1970 millis 1000 /f seconds +dt ; unix-1970 millis 1000 /f seconds +dt ;
: now ( -- timestamp ) gmt >local-time ; : now ( -- timestamp ) gmt >local-time ;
: before ( dt -- -dt ) tuple-slots [ neg ] map array>dt ; : before ( dt -- -dt ) tuple-slots vneg array>dt ;
: from-now ( dt -- timestamp ) now swap +dt ; : from-now ( dt -- timestamp ) now swap +dt ;
: ago ( dt -- timestamp ) before from-now ; : ago ( dt -- timestamp ) before from-now ;

View File

@ -319,7 +319,7 @@ TUPLE: lazy-from-by n quot ;
C: lfrom-by lazy-from-by ( n quot -- list ) C: lfrom-by lazy-from-by ( n quot -- list )
: lfrom ( n -- list ) : lfrom ( n -- list )
[ 1 + ] lfrom-by ; [ 1+ ] lfrom-by ;
M: lazy-from-by car ( lazy-from-by -- car ) M: lazy-from-by car ( lazy-from-by -- car )
lazy-from-by-n ; lazy-from-by-n ;

View File

@ -27,7 +27,7 @@ IN: opengl
swap glBegin call glEnd ; inline swap glBegin call glEnd ; inline
: do-enabled ( what quot -- ) : do-enabled ( what quot -- )
over glEnable swap slip glDisable ; inline over glEnable dip glDisable ; inline
: do-matrix ( mode quot -- ) : do-matrix ( mode quot -- )
swap [ glMatrixMode glPushMatrix call ] keep swap [ glMatrixMode glPushMatrix call ] keep

View File

@ -2,7 +2,7 @@ USING: alien alien.c-types arrays assocs byte-arrays inference
inference.transforms io io.binary io.streams.string kernel inference.transforms io io.binary io.streams.string kernel
math math.parser namespaces parser prettyprint math math.parser namespaces parser prettyprint
quotations sequences strings threads vectors quotations sequences strings threads vectors
words macros ; words macros math.functions ;
IN: pack IN: pack
SYMBOL: big-endian SYMBOL: big-endian
@ -10,9 +10,6 @@ SYMBOL: big-endian
: big-endian? ( -- ? ) : big-endian? ( -- ? )
1 <int> *char zero? ; 1 <int> *char zero? ;
: clear-bit ( m n -- o )
2^ bitnot bitand ;
: >endian ( obj n -- str ) : >endian ( obj n -- str )
big-endian get [ >be ] [ >le ] if ; inline big-endian get [ >be ] [ >le ] if ; inline
@ -88,7 +85,7 @@ M: string b, ( n string -- ) heap-size b, ;
"\0" read-until [ drop f ] unless ; "\0" read-until [ drop f ] unless ;
: read-c-string* ( n -- str/f ) : read-c-string* ( n -- str/f )
read [ 0 = ] right-trim dup empty? [ drop f ] when ; read [ zero? ] right-trim dup empty? [ drop f ] when ;
: (read-128-ber) ( n -- n ) : (read-128-ber) ( n -- n )
1 read first 1 read first

View File

@ -4,7 +4,7 @@ USING: kernel namespaces arrays quotations sequences assocs combinators
IN: random-weighted IN: random-weighted
: probabilities ( weights -- probabilities ) dup sum [ / ] curry map ; : probabilities ( weights -- probabilities ) dup sum v/n ;
: layers ( probabilities -- layers ) : layers ( probabilities -- layers )
dup length 1+ [ head ] with map 1 tail [ sum ] map ; dup length 1+ [ head ] with map 1 tail [ sum ] map ;

View File

@ -85,7 +85,7 @@ TUPLE: slides ;
>r first3 r> head 3array ; >r first3 r> head 3array ;
: strip-tease ( data -- seq ) : strip-tease ( data -- seq )
dup third length 1 - [ dup third length 1- [
2 + (strip-tease) 2 + (strip-tease)
] with map ; ] with map ;

View File

@ -35,7 +35,7 @@ linkname magic version uname gname devmajor devminor prefix ;
: header-checksum ( seq -- x ) : header-checksum ( seq -- x )
148 cut-slice 8 tail-slice 148 cut-slice 8 tail-slice
[ 0 [ + ] reduce ] 2apply + 256 + ; [ sum ] 2apply + 256 + ;
TUPLE: checksum-error ; TUPLE: checksum-error ;
TUPLE: malformed-block-error ; TUPLE: malformed-block-error ;
@ -164,7 +164,7 @@ TUPLE: unimplemented-typeflag header ;
! Long file name ! Long file name
: typeflag-L ( header -- ) : typeflag-L ( header -- )
<string-writer> [ read-data-blocks ] keep <string-writer> [ read-data-blocks ] keep
>string [ CHAR: \0 = ] right-trim filename set >string [ zero? ] right-trim filename set
global [ "long filename: " write filename get . flush ] bind global [ "long filename: " write filename get . flush ] bind
filename get tar-path+ make-directories ; filename get tar-path+ make-directories ;
@ -196,7 +196,7 @@ TUPLE: unimplemented-typeflag header ;
! global [ dup tar-header-name [ print flush ] when* ] bind ! global [ dup tar-header-name [ print flush ] when* ] bind
dup tar-header-typeflag dup tar-header-typeflag
{ {
{ CHAR: \0 [ typeflag-0 ] } { 0 [ typeflag-0 ] }
{ CHAR: 0 [ typeflag-0 ] } { CHAR: 0 [ typeflag-0 ] }
{ CHAR: 1 [ typeflag-1 ] } { CHAR: 1 [ typeflag-1 ] }
{ CHAR: 2 [ typeflag-2 ] } { CHAR: 2 [ typeflag-2 ] }