Factors of an integer: Difference between revisions
m
→{{header|AppleScript}}: (updated primitives)
(→{{Header|Haskell}}: mention and link to factorise from arithmoi) |
m (→{{header|AppleScript}}: (updated primitives)) |
||
Line 298:
-- GENERIC LIBRARY FUNCTIONS
-- map :: (a -> b) -> [a] -> [b]▼
on map(f, xs)▼
set mf to mReturn(f)▼
set lng to length of xs▼
set lst to {}▼
repeat with i from 1 to lng▼
set end of lst to mf's lambda(item i of xs, i, xs)▼
end repeat▼
return lst▼
end map▼
-- filter :: (a -> Bool) -> [a] -> [a]
on filter(f, xs)
▲ set lst to {}
set
▲ repeat with i from 1 to lng
end repeat▼
end filter
▲-- map :: (a -> b) -> [a] -> [b]
▲on map(f, xs)
▲ set lng to length of xs
set lst to {}
repeat with i from 1 to lng
▲ end repeat
▲ return lst
▲end map
-- range :: Int -> Int -> [Int]
on range(m, n)
▲ else
set d to 1
end if
set lst to {}
repeat with i from m to n by d
|