I'm trying to cut the list using append, i.e. if the input is copycat([may,be,i,can,help,you,with,that],X)
X = [i,can,help,you]
copycat([],[]). copycat([H|T], L1):- append([i], L1, [H|T]). I tried to do it using append, however it seems to only work for list starts with 'i'.
https://stackoverflow.com/questions/66593618/how-to-cut-list-in-prolog March 12, 2021 at 11:08AM
没有评论:
发表评论