1
有另一個問題: 有一個單詞列表。如果單詞的長度超過給定長度(例如4),它將被放入另一個列表中。Sicstus Prolog - 將單詞放入列表
我想:
require_min_length([], _, []).
require_min_length([Word|Words], Minl, [List]):-
word_length(Word, W), % method word_length return the length of a word.
(W >= Minl -> append(Word, List, List), require_min_length(Words, Minl, List);
require_min_length(Words, Minl, List)).
結果我:
| ?- Words=["ABCD", "ABCDE", "AAA"], require_min_weight(Words, 5, Lists).
! Resource error: insufficient memory.
正確的結果將是:
Lists = [[65, 66, 67, 68, 69]]. (% ascii)
如何更改密碼?任何幫助請!謝謝。