1: 1 1 CALL pred interactive.main/2-0 (cc_multi) interactive.m:23 mdb> echo on Command echo enabled. mdb> query interactive list ?- append(X, Y, ['a', 'b', 'c']). :026: Inferred :- pred query(list.list(character), :026: list.list(character)). :026: Inferred :- mode query(out, out) is multi. X = [], Y = ['a', 'b', 'c'], true ; X = ['a'], Y = ['b', 'c'], true ; X = ['a', 'b'], Y = ['c'], true ; X = ['a', 'b', 'c'], Y = [], true ; fail. No (more) solutions. ?- qperm([1,2,3], List). :026: Inferred :- pred query(list.list(int)). :026: Inferred :- mode query(out) is nondet. List = [1, 2, 3], true ; List = [1, 3, 2], true ; List = [2, 1, 3], true ; List = [2, 3, 1], true ; List = [3, 1, 2], true ; List = [3, 2, 1], true ; fail. No (more) solutions. ?- qperm([1,2,3], List), List = [2 | _]. :001: In clause for predicate `mdb_query.query'/2: :001: warning: variable `_2' occurs more than once in this scope. :013: In clause for predicate `mdb_query.run'/2: :013: warning: variable `_2' occurs more than once in this scope. :014: In clause for predicate `mdb_query.run'/2: :014: warning: variable `_2' occurs more than once in this scope. :015: In clause for predicate `mdb_query.run'/2: :015: warning: variable `_2' occurs more than once in this scope. :026: In clause for predicate `mdb_query.query'/2: :026: warning: variable `_2' occurs more than once in this scope. :026: Inferred :- pred query(list.list(int), list.list(int)). :026: Inferred :- mode query(out, out) is nondet. List = [2, 1, 3], _2 = [1, 3], true ; List = [2, 3, 1], _2 = [3, 1], true ; fail. No (more) solutions. ?- qperm([1,2,3], List), List = [4 | _]. :001: In clause for predicate `mdb_query.query'/2: :001: warning: variable `_2' occurs more than once in this scope. :013: In clause for predicate `mdb_query.run'/2: :013: warning: variable `_2' occurs more than once in this scope. :014: In clause for predicate `mdb_query.run'/2: :014: warning: variable `_2' occurs more than once in this scope. :015: In clause for predicate `mdb_query.run'/2: :015: warning: variable `_2' occurs more than once in this scope. :026: In clause for predicate `mdb_query.query'/2: :026: warning: variable `_2' occurs more than once in this scope. :026: Inferred :- pred query(list.list(int), list.list(int)). :026: Inferred :- mode query(out, out) is nondet. fail. No (more) solutions. ?- qperm([1,2,"foo"], List). :001: In clause for predicate `query'/1: :001: in argument 1 of call to predicate `qperm'/2: :001: in list element #2: :001: type error in unification of argument :001: and constant `"foo"'. :001: argument has type `int', :001: constant `"foo"' has type `string'. For more information, recompile with `-E'. Compilation error(s) occurred. ?- qperm(List, [1]). :014: In clause for `run(di, uo)': :014: in call to predicate `mdb_query.query'/1: :014: mode error: argument `List' has the following inst: :014: free :014: which does not match any of the valid modes for the callee, :014: because of the following error. :026: In clause for `query(out(not_reached))': :026: in argument 1 of call to predicate `interactive.qperm'/2: :026: mode error: variable `HeadVar__2' has instantiatedness `free', :026: expected instantiatedness was `ground'. :026: Inferred :- pred query(list.list(int)). For more information, recompile with `-E'. Compilation error(s) occurred. ?- quit. mdb> cc_query interactive list ?- append(X, Y, ['a', 'b', 'c']). :017: Inferred :- pred query(list.list(character), :017: list.list(character)). :017: Inferred :- mode query(out, out) is multi. X = [], Y = ['a', 'b', 'c'], true. ?- qperm([1,2,3], List). :017: Inferred :- pred query(list.list(int)). :017: Inferred :- mode query(out) is nondet. List = [1, 2, 3], true. ?- qperm([1,2,3], List), List = [2 | _]. :001: In clause for predicate `mdb_query.query'/2: :001: warning: variable `_2' occurs more than once in this scope. :011: In clause for predicate `mdb_query.run'/2: :011: warning: variable `_2' occurs more than once in this scope. :012: In clause for predicate `mdb_query.run'/2: :012: warning: variable `_2' occurs more than once in this scope. :017: In clause for predicate `mdb_query.query'/2: :017: warning: variable `_2' occurs more than once in this scope. :017: Inferred :- pred query(list.list(int), list.list(int)). :017: Inferred :- mode query(out, out) is nondet. List = [2, 1, 3], _2 = [1, 3], true. ?- qperm([1,2,3], List), List = [4 | _]. :001: In clause for predicate `mdb_query.query'/2: :001: warning: variable `_2' occurs more than once in this scope. :011: In clause for predicate `mdb_query.run'/2: :011: warning: variable `_2' occurs more than once in this scope. :012: In clause for predicate `mdb_query.run'/2: :012: warning: variable `_2' occurs more than once in this scope. :017: In clause for predicate `mdb_query.query'/2: :017: warning: variable `_2' occurs more than once in this scope. :017: Inferred :- pred query(list.list(int), list.list(int)). :017: Inferred :- mode query(out, out) is nondet. No solution. ?- quit. mdb> io_query interactive list run <-- main. [1, 3, 5, 2, 4] run <-- if { append(X, Y, ['a', 'b', 'c']) } then print("X = "), print(X), print(", Y = "), print(Y), nl else print("No solution\n"). X = [], Y = ['a', 'b', 'c'] run <-- if { qperm([1,2,3], List) } then print(List), nl else []. [1, 2, 3] run <-- if { qperm([1,2,3], List), List = [2 | _] } then print(List), nl else { true }. [2, 1, 3] run <-- if { qperm([1,2,3], List), List = [4 | _] } then print(List), nl else print("No solution, as expected."), io__nl. No solution, as expected. run <-- quit. mdb> continue -n -S [1, 3, 5, 2, 4]