[clean-list] Need help with trivial question: uswap :: A.a:
Int Int *{*{a}} -> *{*{a}}
John van Groningen
johnvg at cs.ru.nl
Fri Aug 17 14:47:06 MEST 2007
lethevert wrote:
>How about this code?
>
>uswap :: A.a: Int Int *{*{a}} -> *{*{a}}
>uswap i j a
> # (ai, a) = replace a i undef
> (aj, a) = replace a j ai
> (_, a) = replace a i aj
> = a
An update can be used instead of the last replace:
uswap :: !Int !Int !*{.a} -> *{.a}
uswap i j a
# (ai, a) = replace a i undef
(aj, a) = replace a j ai
= {a & [i] = aj}
Kind regards,
John van Groningen
More information about the clean-list
mailing list