fork download
  1. listToNumber(List, Number) :- listToNumber(List, 0, Number).
  2. listToNumber([], X, X).
  3. listToNumber([H | Tail], A, X) :-
  4. Anew is A * 10 + H,
  5. listToNumber(Tail, Anew, X).
  6.  
  7. shatter(InList, OutLists) :-
  8. length(InList, InL),
  9. between(1, InL, OutL),
  10. length(OutLists, OutL),
  11. append(OutLists, InList),
  12. forall(member(SubOutLists, OutLists), SubOutLists \= []).
  13.  
  14. split(InList, OutLists) :-
  15. shatter(InList, OutLists),
  16. length(OutLists, 3).
  17.  
  18. isEqual(X) :-
  19. permutation(X, [1,2,3,4,5,6,7,8,9]),
  20. split(X, List),
  21. maplist(listToNumber, List, Y),
  22. Y = [Multiplicand, Multiplier, Product],
  23. Product =:= Multiplicand * Multiplier.
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty