I used set_prolog_flag(stack_limit, 5000000000). in my code.
But then i got the following error:
ERROR: No permission to modify static procedure "set_prolog_flag/2"
It seem that i don't have persmission to modify stack_size.Is there a solution to this?
Emolai, it seems that you consulted info out of date.
You need to set the stack limits this way:
:- set_prolog_stack(stack, limit(5000000000)).
See the colon+minus? This signify that the goal set_prolog_stack/2 is to be executed and not defining a new clause set_prolog_stack/2. This explains the error you got.
You are now good to go. Is your question solved ?
Related
I'm trying to modify the initial configuration of SWI-Prolog in command line, following the official documentation from SWI-Prolog FAQ 1 and 2 to change the output displayed. However, I have run into this error:
X#X:~/Documents/Prolog$ swi-prolog.swipl
ERROR: /home/X/snap/swi-prolog/55/.config/swi-prolog/init.pl:1:
ERROR: No permission to modify static procedure `set_prolog_flag/2'
Welcome to SWI-Prolog (threaded, 64 bits, version 8.4.3)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
The file init.pl is a one liner:
set_prolog_flag(answer_write_options, [quoted(true), portray(true), max_depth(18)]).
All the information I found was that the error could be related to a system-defined flag that is not marked changeable, since other entries in this forum for No permission to modify static procedure are more related to syntax error.
I'm new to prolog, helps and suggestions are welcomed!
You tried to redefine set_prolog_flag/2 as a fact.
Add :- in front of it to make it a directive.
I am new to Prolog and using the SWISH SWI online PROLOG website. https://swish.swi-prolog.org/
I am trying a really basic program:
a('jae').
b('lii').
c('jackson').
happy(A):-sings(A).
happy(B):-dances(B).
goToPlay(C):-free(C).
trying to run happy(jae). gives the following error
procedure `sings(A)' does not exist
Reachable from:
happy(A)
Please help me solve this.
If submit the goal
happy(jae).
Then rule
happy(A) :- sings(A).
applies, which means that the next goal to be solved is
sings(A).
with A = jae.
Unfortunately the one-argument predicate sings/1 is nowhere to be found, so you get the same error as for a missing procedure in another programming language.
You have to define sings/1.
I am trying to use a supposedly built in procedure in SWI-Prolog.
The procedure in question is sort/4.
The thing is, when I try to use it in my program I get the following error:
ERROR: Undefined procedure: sort/4
ERROR: However, there are definitions for:
ERROR: msort/2
ERROR: sort/2
I don't understand because the documentation says its built-in, but Prolog doesn't know it. I really need to use this procedure
Would you know how to fix this issue ? I thought it was a matter of library and tried to add ":- use_module(library(lists))." at the beginning of my code but the situation remains the same.
Hope you can help me, have a good day
The sort/4 predicate as documented here is relatively new. If you get the latest stable or development version of SWI-Prolog it should be available. It is a built-in, not a part of a library.
I tried to compile a asn file with Erlang's asn1ct:compile function. I run the following code:
asn1ct:compile("PDU-definitions", [per, verbose]).
then got the following errors:
...
{error,{system_limit,[{erlang,list_to_atom,
["enc_InterRATHandoverInfo_v390NonCriticalExtensions_present_v3a0NonCriticalExtensions_laterNonCriticalExtensions_v3g0NonCriticalExtensions_v4b0NonCriticalExtensions_v4d0NonCriticalExtensions_v590NonCriticalExtensions_v690NonCriticalExtensions_nonCriticalExtensions"], []},
...
I googled and found there's a 255-character length limitation of Erlang's atom. Because there are too many nested data structure in the ASN file, the length of corresponding atom exceed the limitation.
My question is: if I can modify the default length limitation to a bigger value, or there are some workarounds for this situation?
Thanks!
As of R17, there remains no way to modify the maximum character limit in Erlang outside of modifying the source and recompiling. A sparse look at asn1ct's documentation suggests no means of changing the atom-encoding behaviour, either.
Best bet that I saw was the "n2n" option of compiling, which instructs the compiler to generate functions for doing name-to-enumeration conversion. I assume that it will still construct atoms in this case, however, which would be a moot point.
Nothing else in the documentation suggests a way to change name-construction behaviour, and as such severely nested data structures will cause problems.
Silly question, but I'm trying to get this simple Prolog program working. I have written other small Prolog programs with no problem, but this one is giving me trouble:
test :- write 'test1234 test1234',nl,halt.
That's it. The file is saved as adventure1.pl. It is loaded into SWI-Prolog on Ubuntu with the command line option:
prolog -s adventure1.pl
When loaded into the Prolog interpreter I enter the following:
start.
However, Prolog says undefined procedure: test/0 (DWIM could not correct goal). What is the error here, is it somthing really simple. I wrote this because I have example programs that use a predecate named start which displays text, yet I can't even get this to work.
write 'test1234 test1234'
is a syntax error, as SWI-Prolog clearly indicates:
ERROR: /tmp/adventure1.pl:2:10: Syntax error: Operator expected
It should be
write('test1234 test1234')
(Of course, that won't solve the problem of start not working, because you've defined test.)