Fix this by adding a check at the beginning of each that N=>length(InputSeq)
?- poly([0,1,16,81,256],2,R).
ERROR: Type error: `integer' expected, found `12.0' (a float)
ERROR: In:
ERROR: [19] throw(error(type_error(integer,12.0),_47384))
ERROR: [16] clpfd:'__aux_maplist/2_fd_variable+0'([12.0,2.0]) at /usr/local/Cellar/swi-prolog/8.2.1/libexec/lib/swipl/library/clp/clpfd.pl:1622
ERROR: [12] clpfd:scalar_product([1,1|...],[0,2|...],#=,_47468) at /usr/local/Cellar/swi-prolog/8.2.1/libexec/lib/swipl/library/clp/clpfd.pl:2148
ERROR: [10] poly([0,1|...],2,_47520) at /Users/4meta5/skool/4610/prolog/reconocer/reconocer.pl:83
ERROR: [9] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
?- poly_sum([0,1,16,81,256],3,R).
ERROR: Type error: `integer' expected, found `4.800000000000001' (a float)
ERROR: In:
ERROR: [20] throw(error(type_error(integer,4.800000000000001),_68054))
ERROR: [17] clpfd:'__aux_maplist/2_fd_variable+0'([4.800000000000001]) at /usr/local/Cellar/swi-prolog/8.2.1/libexec/lib/swipl/library/clp/clpfd.pl:1622
ERROR: [12] clpfd:scalar_product([1,1|...],[0,6|...],#=,_68132) at /usr/local/Cellar/swi-prolog/8.2.1/libexec/lib/swipl/library/clp/clpfd.pl:2148
ERROR: [10] poly_sum([0,1|...],3,_68184) at /Users/4meta5/skool/4610/prolog/reconocer/reconocer.pl:94
ERROR: [9] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
Fix this by adding a check at the beginning of each that N=>length(InputSeq)