[clean-list] Need help with trivial question: uswap :: A.a: Int Int *{*{a}} -> *{*{a}}

lethevert acatofearlgrey at ybb.ne.jp
Thu Aug 16 02:10:19 MEST 2007


Hello, Vag

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


vag wrote:
> Hello, friends! H
> 
> In the course of several days I trying to write a function to swap two 
> array elements:
> 
> uswap :: A.a: Int Int *{*{a}} -> *{*{a}}
> usap i j a =
>    ?
> 
> None of the variants even compiled. *sob*
> 
> Can you point me towards the solution?
> 
> Maybe there are hidden tricky corresponding toolbox function lurks in 
> library?
> 
> Sincerely yours,
> Vag.
> 
> 
> P.S. Thanks in advance, John.
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list
> 

-- 
lethevert
lethevert at users.sourceforge.net
http://lethevert.blogspot.com/


More information about the clean-list mailing list