Advertisement
samham1218

Untitled

Nov 3rd, 2018
3,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fun insEverywhere e nil = [[e]]
  2.   | insEverywhere e (y::ys) =
  3.     (e::y::ys) :: (map (fn u => y::u) (insEverywhere e ys));
  4.  
  5. fun appendAll nil = nil
  6.   | appendAll (z::zs) = z @ (appendAll zs)
  7.  
  8. fun perm nil = [ nil ]
  9.   | perm (x::xs) =
  10.     appendAll (map (insEverywhere x) (perm xs));
  11.  
  12. perm[1,2,3];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement