Kostas Oikonomou wrote: > I have the following program: > > :- lib(m_map). > > make4(List, M) :- > init(M), > (foreach(X,List) do > search(M,X,Y) > ). > > > When I execute the query > > [eclipse 3]: make4([1,2,3], M). > *** Overflow of the local/control stack! > You can use the "-l kBytes" (LOCALSIZE) option to have a > larger stack. > Peak sizes were: local stack 62464 kbytes, control stack > 68608 kbytes > Abort > [eclipse 4]: > > I don't understand what is going on. You are missing a param(M) in the loop header, because you are passing the M into the loop (the "logical loops" are a bit unusual in that respect): init(M), (foreach(X,List),param(M) do search(M,X,Y) ). Without this, search/3 is called with a fresh local variable M, which causes it to loop and overflow a stack. The compiler warned you about this danger by saying *** Warning: Singleton local variable M in do-loop, maybe param(M) missing? Cheers, JoachimReceived on Tue Sep 13 2011 - 00:12:09 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET