Symmetric difference: Difference between revisions
→{{header|AppleScript}}: Some simplifications
(→{{header|AppleScript}}: Some simplifications) |
|||
Line 163:
-- union :: [a] -> [a] -> [a]
on union(xs, ys)
end union
-- difference :: [a] -> [a] -> [a]
on difference(xs, ys)
script
on
if a contains y then
else
a
end if
end
end script
foldl(except
end difference
Line 215 ⟶ 214:
-- delete :: a -> [a] -> [a]
on delete_(x, xs)
script
on lambda(a, y)
if y =
a
else
Line 225 ⟶ 224:
end script
foldl(
end delete_
Line 240 ⟶ 239:
return v
end foldl
script▼
property g : f▼
end lambda▼
-- Lift 2nd class handler function into 1st class script wrapper
-- mReturn :: Handler -> Script
on mReturn(f)
if class of f is script then
else
▲ end script
end mReturn
</lang>
|