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

View File

@ -27,7 +27,7 @@ IN: opengl
swap glBegin call glEnd ; inline
: do-enabled ( what quot -- )
over glEnable swap slip glDisable ; inline
over glEnable dip glDisable ; inline
: do-matrix ( mode quot -- )
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
math math.parser namespaces parser prettyprint
quotations sequences strings threads vectors
words macros ;
words macros math.functions ;
IN: pack
SYMBOL: big-endian
@ -10,9 +10,6 @@ SYMBOL: big-endian
: big-endian? ( -- ? )
1 <int> *char zero? ;
: clear-bit ( m n -- o )
2^ bitnot bitand ;
: >endian ( obj n -- str )
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 ;
: 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 )
1 read first

View File

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

View File

@ -35,7 +35,7 @@ linkname magic version uname gname devmajor devminor prefix ;
: header-checksum ( seq -- x )
148 cut-slice 8 tail-slice
[ 0 [ + ] reduce ] 2apply + 256 + ;
[ sum ] 2apply + 256 + ;
TUPLE: checksum-error ;
TUPLE: malformed-block-error ;
@ -164,7 +164,7 @@ TUPLE: unimplemented-typeflag header ;
! Long file name
: typeflag-L ( header -- )
<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
filename get tar-path+ make-directories ;
@ -196,7 +196,7 @@ TUPLE: unimplemented-typeflag header ;
! global [ dup tar-header-name [ print flush ] when* ] bind
dup tar-header-typeflag
{
{ CHAR: \0 [ typeflag-0 ] }
{ 0 [ typeflag-0 ] }
{ CHAR: 0 [ typeflag-0 ] }
{ CHAR: 1 [ typeflag-1 ] }
{ CHAR: 2 [ typeflag-2 ] }