Day of the week: Difference between revisions
m
→{{header|AppleScript}}: (light refactor)
m (→{{header|QL SuperBASIC}}: minor corrections) |
m (→{{header|AppleScript}}: (light refactor)) |
||
Line 334:
Or, composing generic functions:
<lang applescript>
on xmasIsSunday(y)
tell (current
▲ set {its year, its month, its day, its time} to {y, 12, 25, 0}
▲ return its weekday is Sunday
end xmasIsSunday
▲ end tell
-------------------------- TEST ---------------------------
on run
▲ filter(xmasOnSunday, enumFromTo(2008, 2121))
end run
-- enumFromTo :: Int -> Int -> [Int]
Line 358 ⟶ 361:
set end of lst to i
end repeat
else
end if
end enumFromTo
-- filter :: (a -> Bool) -> [a] -> [a]
Line 376 ⟶ 380:
end tell
end filter
-- Lift 2nd class handler function into 1st class script wrapper
|