我在练习中有一些误解。它说交换两个字母。它有一个例子女性,它是wmoen.It要求我这样做。我做了什么,它的工作
swapletters(W,CW):- // women because is wmoen
append(A,[X,Y|B],W), //it has A because it keeps the w and swap m and o thats why is out of the [ ],B is the tail that keeps en,W is word.
word(CW),
append(A,[Y,X|B],CW).
我的问题是,如果它是另一个词,如吃,它是eatnig.Will它工作这个代码和它吗?我这样做,但我不确定它。谢谢