I before E except after C: Difference between revisions
m
→AppleScript :: Functional
Line 533:
bln and (int ≠ 1)
end doesFileExist
-- map :: (a -> b) -> [a] -> [b]▼
on map(f, xs)▼
-- The list obtained by applying f▼
-- to each element of xs.▼
tell mReturn(f)▼
set lng to length of xs▼
set lst to {}▼
repeat with i from 1 to lng▼
set end of lst to |λ|(item i of xs, i, xs)▼
end repeat▼
return lst▼
end tell▼
end map▼
Line 575 ⟶ 590:
end if
end mReturn
▲-- map :: (a -> b) -> [a] -> [b]
▲on map(f, xs)
▲ -- The list obtained by applying f
▲ -- to each element of xs.
▲ tell mReturn(f)
▲ set lng to length of xs
▲ set lst to {}
▲ repeat with i from 1 to lng
▲ set end of lst to |λ|(item i of xs, i, xs)
▲ end repeat
▲ return lst
▲ end tell
▲end map
Line 614:
(round (x * d)) / d
end roundTo
-- scriptFolder :: () -> IO FilePath▼
on scriptFolder()▼
-- The path of the folder containing this script▼
tell application "Finder" to ¬▼
POSIX path of ((container of (path to me)) as alias)▼
end scriptFolder▼
Line 633 ⟶ 641:
end if
end splitAt
▲-- scriptFolder :: () -> IO FilePath
▲on scriptFolder()
▲ -- The path of the folder containing this script
▲ tell application "Finder" to ¬
▲ POSIX path of ((container of (path to me)) as alias)
▲end scriptFolder
|