Cleanups found with lint tool
parent
e563824cd2
commit
933319f401
|
@ -33,19 +33,19 @@ TUPLE: timestamp
|
|||
C: <timestamp> timestamp
|
||||
|
||||
: gmt-offset-duration ( -- duration )
|
||||
0 0 0 gmt-offset <duration> ;
|
||||
0 0 0 gmt-offset <duration> ; inline
|
||||
|
||||
: <date> ( year month day -- timestamp )
|
||||
0 0 0 gmt-offset-duration <timestamp> ;
|
||||
0 0 0 gmt-offset-duration <timestamp> ; inline
|
||||
|
||||
: <date-gmt> ( year month day -- timestamp )
|
||||
0 0 0 instant <timestamp> ;
|
||||
0 0 0 instant <timestamp> ; inline
|
||||
|
||||
: <year> ( year -- timestamp )
|
||||
1 1 <date> ;
|
||||
1 1 <date> ; inline
|
||||
|
||||
: <year-gmt> ( year -- timestamp )
|
||||
1 1 <date-gmt> ;
|
||||
1 1 <date-gmt> ; inline
|
||||
|
||||
ERROR: not-a-month ;
|
||||
M: not-a-month summary
|
||||
|
@ -352,14 +352,14 @@ M: duration time-
|
|||
before time+ ;
|
||||
|
||||
: <zero> ( -- timestamp )
|
||||
0 0 0 0 0 0 instant <timestamp> ;
|
||||
0 0 0 <date-gmt> ; inline
|
||||
|
||||
: valid-timestamp? ( timestamp -- ? )
|
||||
clone instant >>gmt-offset
|
||||
dup <zero> time- <zero> time+ = ;
|
||||
|
||||
: unix-1970 ( -- timestamp )
|
||||
1970 1 1 0 0 0 instant <timestamp> ;
|
||||
1970 <year-gmt> ; inline
|
||||
|
||||
: millis>timestamp ( x -- timestamp )
|
||||
[ unix-1970 ] dip milliseconds time+ ;
|
||||
|
@ -529,16 +529,16 @@ M: timestamp end-of-year 12 >>month 31 >>day ;
|
|||
M: integer end-of-year 12 31 <date> ;
|
||||
|
||||
: time-since-midnight ( timestamp -- duration )
|
||||
dup midnight time- ;
|
||||
dup midnight time- ; inline
|
||||
|
||||
: since-1970 ( duration -- timestamp )
|
||||
unix-1970 time+ ;
|
||||
unix-1970 time+ ; inline
|
||||
|
||||
: timestamp>unix-time ( timestamp -- seconds )
|
||||
unix-1970 time- second>> ;
|
||||
unix-1970 time- second>> ; inline
|
||||
|
||||
: unix-time>timestamp ( seconds -- timestamp )
|
||||
seconds unix-1970 time+ ;
|
||||
seconds since-1970 ; inline
|
||||
|
||||
{
|
||||
{ [ os unix? ] [ "calendar.unix" ] }
|
||||
|
|
|
@ -205,7 +205,7 @@ ERROR: invalid-timestamp-format ;
|
|||
read-sp checked-number >>year
|
||||
":" read-token checked-number >>hour
|
||||
":" read-token checked-number >>minute
|
||||
" " read-token checked-number >>second
|
||||
read-sp checked-number >>second
|
||||
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
||||
|
||||
: rfc822>timestamp ( str -- timestamp )
|
||||
|
@ -224,7 +224,7 @@ ERROR: invalid-timestamp-format ;
|
|||
read-sp checked-number >>year
|
||||
":" read-token checked-number >>hour
|
||||
":" read-token checked-number >>minute
|
||||
" " read-token checked-number >>second
|
||||
read-sp checked-number >>second
|
||||
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
||||
|
||||
: cookie-string>timestamp-1 ( str -- timestamp )
|
||||
|
@ -237,7 +237,7 @@ ERROR: invalid-timestamp-format ;
|
|||
read-sp checked-number >>day
|
||||
":" read-token checked-number >>hour
|
||||
":" read-token checked-number >>minute
|
||||
" " read-token checked-number >>second
|
||||
read-sp checked-number >>second
|
||||
read-sp checked-number >>year
|
||||
readln parse-rfc822-gmt-offset >>gmt-offset ;
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ IN: core-foundation.time
|
|||
TYPEDEF: double CFTimeInterval
|
||||
TYPEDEF: double CFAbsoluteTime
|
||||
|
||||
: >CFTimeInterval ( duration -- interval )
|
||||
duration>seconds ; inline
|
||||
ALIAS: >CFTimeInterval duration>seconds
|
||||
|
||||
MEMO: epoch ( -- micros )
|
||||
T{ timestamp { year 2001 } { month 1 } { day 1 } } timestamp>micros ;
|
||||
|
|
|
@ -33,11 +33,11 @@ MACRO: set-firstn ( n -- )
|
|||
bi-curry '[ _ _ bi ]
|
||||
] if ;
|
||||
|
||||
: nappend-as ( n exemplar -- seq )
|
||||
[ narray concat ] dip like ; inline
|
||||
|
||||
: nappend ( n -- seq ) narray concat ; inline
|
||||
|
||||
: nappend-as ( n exemplar -- seq )
|
||||
[ nappend ] dip like ; inline
|
||||
|
||||
MACRO: nmin-length ( n -- )
|
||||
dup 1 - [ min ] n*quot
|
||||
'[ [ length ] _ napply @ ] ;
|
||||
|
|
|
@ -10,16 +10,16 @@ IN: unicode.case.tests
|
|||
[ t ] [ "hello how are you?" lower? ] unit-test
|
||||
[
|
||||
[ f ] [ i-dot? ] unit-test
|
||||
[ f ] [ lt? ] unit-test
|
||||
[ f ] [ lithuanian? ] unit-test
|
||||
"tr" locale set
|
||||
[ t ] [ i-dot? ] unit-test
|
||||
[ f ] [ lt? ] unit-test
|
||||
[ f ] [ lithuanian? ] unit-test
|
||||
[ "i\u000131i \u000131jj" ] [ "i\u000131I\u000307 IJj" >lower ] unit-test
|
||||
[ "I\u000307\u000131i Ijj" ] [ "i\u000131I\u000307 IJj" >title ] unit-test
|
||||
[ "I\u000307II\u000307 IJJ" ] [ "i\u000131I\u000307 IJj" >upper ] unit-test
|
||||
"lt" locale set
|
||||
[ f ] [ i-dot? ] unit-test
|
||||
[ t ] [ lt? ] unit-test
|
||||
[ t ] [ lithuanian? ] unit-test
|
||||
[ "i\u000307\u000300" ] [ HEX: CC 1string nfd >lower ] unit-test
|
||||
[ "\u00012f\u000307" ] [ HEX: 12E 1string nfd >lower nfc ] unit-test
|
||||
[ "I\u000300" ] [ "i\u000307\u000300" >upper ] unit-test
|
||||
|
|
|
@ -20,9 +20,6 @@ SYMBOL: locale ! Just casing locale, or overall?
|
|||
: i-dot? ( -- ? )
|
||||
locale get { "tr" "az" } member? ;
|
||||
|
||||
: lt? ( -- ? )
|
||||
locale get "lt" = ;
|
||||
|
||||
: lithuanian? ( -- ? ) locale get "lt" = ;
|
||||
|
||||
: lithuanian>upper ( string -- lower )
|
||||
|
@ -87,7 +84,7 @@ PRIVATE>
|
|||
|
||||
: >lower ( string -- lower )
|
||||
i-dot? [ turk>lower ] when
|
||||
lt? [ lithuanian>lower ] when
|
||||
lithuanian? [ lithuanian>lower ] when
|
||||
final-sigma
|
||||
[ lower>> ] [ ch>lower ] map-case ;
|
||||
|
||||
|
@ -95,7 +92,7 @@ HINTS: >lower string ;
|
|||
|
||||
: >upper ( string -- upper )
|
||||
i-dot? [ turk>upper ] when
|
||||
lt? [ lithuanian>upper ] when
|
||||
lithuanian? [ lithuanian>upper ] when
|
||||
[ upper>> ] [ ch>upper ] map-case ;
|
||||
|
||||
HINTS: >upper string ;
|
||||
|
@ -104,7 +101,7 @@ HINTS: >upper string ;
|
|||
|
||||
: (>title) ( string -- title )
|
||||
i-dot? [ turk>upper ] when
|
||||
lt? [ lithuanian>upper ] when
|
||||
lithuanian? [ lithuanian>upper ] when
|
||||
[ title>> ] [ ch>title ] map-case ; inline
|
||||
|
||||
PRIVATE>
|
||||
|
|
Loading…
Reference in New Issue