Handbook
Glossary
days-in-year ( obj -- n )
Calendar
ยป
Year operations
Prev:
leap-year? ( obj -- ? )
Vocabulary
calendar
Inputs
obj
a
timestamp
or an
integer
Outputs
n
an
integer
Word description
Calculates the number of days in a given year.
Examples
USING: calendar prettyprint ; 2004 days-in-year .
366
Definition
IN:
calendar
GENERIC:
days-in-year
( obj -- n )
Methods
USING:
calendar
kernel
math
;
M:
integer
days-in-year
leap-year?
366 365
?
;
USING:
accessors
calendar
;
M:
timestamp
days-in-year
year>>
days-in-year
;