-
|
Hi, I get this error when trying to run the below code: Could this be an incompatibility between the Any help is much appreciated. :- use_module(clpz).
:- use_module(format).
:- use_module(lists).
sum_chord([N1, N2, N3, N4]) :-
[N1, N2, N3, N4] ins 0..11,
sum_list([N1, N2, N3, N4], 26).
label_chords(Chord) :-
sum_chord(Chord),
label(Chord).
render(Chord, File) :-
open(File, write, Out),
forall(label_chords(Chord), format(Out,'~w ~w ~w ~w~n', Chord)),
close(Out).
go :- render([N1, N2, N3, N4], 'chords.txt').
?- go.More context: I was trying to generate chords that sum to 26 inspired by this article: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
Use sum/3 from clpz instead of sum_list/2 |
Beta Was this translation helpful? Give feedback.
-
|
All these chords sum to 26. Yay! https://git.sr.ht/~whereiseveryone/prolog-scratch/commit/43e7a55b72c133334ae01a752b49d7b5fe5bcd80 |
Beta Was this translation helpful? Give feedback.
Use sum/3 from clpz instead of sum_list/2
https://www.scryer.pl/clpz.html#sum/3