I should write a program in prol, when a list is given, returns the ordering of its power saver. One thing I forgot to forget: I already have a definition that turns a list upside down: deep _relev (list, modified list). For example: How to get all the subbalists and how to organize the list: [A], [A, C] , [B, A], [B, A, C], [B], [B, C], [C, B] A, B, C] C, A], [A, C, B], [C, A, B], [C, B, A]]. ? - sublist_perm ([a, b, c], x). will come back: (Duplicates are allowed)
X = []; X = [C]; X = [b]; X = [B, C]; X = [C, B]; X = [A]; X = [A, C]; X = [C, A]; X = [A, B]; X = [B, A]; X = [A, B, C]; X = [B, A, C]; X = [B, C, A]; X = [A, C, B]; X = [C, A, B]; X = [C, B, A]
sublist_perm (in, out): - sublist (in, temporary), permutation (temporary, out) Sublist ([], []) Sublist ([_ | XS], YS): - Novelist (Xs, YS) Sublist ([x | x], [x | ys]): - Sublist (xs, ys) axle X, sublist_perm ([a, b, c], x), xs), xs [[[] [/ p]
No comments:
Post a Comment