Day of the week: Difference between revisions
m
→{{header|AppleScript}}: Minor tidying
No edit summary |
m (→{{header|AppleScript}}: Minor tidying) |
||
Line 263:
Or, composing generic functions:
<lang applescript>
script xmasOnSunday
on |λ|(y)
▲-- xmasIsSunday :: Int -> Bool
tell (current date)▼
set {its year, its month, its day, its time} to {y, 12, 25, 0}
▲ tell (current date)
end
filter(xmasOnSunday, enumFromTo(2008, 2121))
end run
Line 279 ⟶ 282:
-- enumFromTo :: Int -> Int -> [Int]
on enumFromTo(m, n)
if m
set
set end of lst to i▼
end repeat
return lst▼
else
end if
▲ repeat with i from m to n by d
▲ set end of lst to i
▲ end repeat
▲ return lst
end enumFromTo
|