./configure --prefix=/opt/gupu --with-c-flags='-O3 -fomit-frame-pointer' && make
get_byte/1
, get_char/1
... mais
aussi putatom/1
(de DEC10 en 1978).
get_line_to_chars/2
on a end_of_file
,
et pour get_line_to_codes/2
on a -1
.
SO.
| ?- repeat, open(.,read,S), writeq(S),nl,fail. repeat, open(.,read,S), writeq(S),nl,fail. '$stream'(3) '$stream'(4) ... '$stream'(1023) uncaught exception: error(permission_error(open,source_sink,'.'),open/3) | ?-Attendu: resource_error.
ulrich@p0:/opt/gupu/src/gprolog-code$ /opt/gupu/gprolog-1.4.3/bin/gprolog GNU Prolog 1.4.3 By Daniel Diaz Copyright (C) 1999-2012 Daniel Diaz | ?- VN_list = 42, read_term(T,[variable_names(VN_list)]). a. no | ?- ulrich@p0:/opt/gupu/src/gprolog-code$ /opt/gupu/gprolog-1.4.4/bin/gprolog GNU Prolog 1.4.4 (64 bits) Compiled Jan 19 2015, 19:32:14 with gcc By Daniel Diaz Copyright (C) 1999-2014 Daniel Diaz | ?- VN_list = 42, read_term(T,[variable_names(VN_list)]). uncaught exception: error(domain_error(read_option,variable_names(42)),read_term/2)Attendu: échec.
| ?- O = alias(_), /**/ open(f,write,_,[O]). uncaught exception: error(domain_error(stream_option,alias(_30)),open/4)Attendu:
instantiation_error
maplist(P_7,X1s,X2s,X3s,X4s,X5s,X6s,X7s) :- maplist_i(X1s,X2s,X3s,X4s,X5s,X6s,X7s,P_7). maplist_i([],[],[],[],[],[],[],_P_7). maplist_i([X1|X1s],[X2|X2s],[X3|X3s],[X4|X4s],[X5|X5s],[X6|X6s],[X7|X7s],P_7) :- call(P_7,X1,X2,X3,X4,X5,X6,X7), maplist_i(X1s,X2s,X3s,X4s,X5s,X6s,X7s,P_7).par
maplist(P_7,X1s,X2s,X3s,X4s,X5s,X6s,X7s) :- maplist_i(X1s,P_7,X2s,X3s,X4s,X5s,X6s,X7s). maplist_i([],_P_7,[],[],[],[],[],[]). maplist_i([X1|X1s],P_7,[X2|X2s],[X3|X3s],[X4|X4s],[X5|X5s],[X6|X6s],[X7|X7s]) :- call(P_7,X1,X2,X3,X4,X5,X6,X7), maplist_i(X1s,P_7,X2s,X3s,X4s,X5s,X6s,X7s).
| ?- X #= -1 div 2. X #= -1 div 2. uncaught exception: error(type_error(fd_evaluable,(div)/2),(#=)/2)Attendu:
X = -1
$ cat n98.pl f(1). ^@f(99). f(2). g('ab^@cd'). g('ef^Agh'). $ od -c n98.pl 0000000 f ( 1 ) . \n \0 f ( 9 9 ) . \n \n f 0000020 ( 2 ) . \n g ( ' a b \0 c d ' ) . 0000040 \n \n g ( ' e f 001 g h ' ) . \n \n 0000057
| ?- X is round(0.5), Y is round(-0.5). X = 0 Y = 0 yesAttendu: X = 1 (comme le font IF, SICStus, Minerva, XSB, Ciao, P4)
| ?- X #>= 0, length(_,X). uncaught exception: error(type_error(integer,_#2097954(0..268435455)),(#>=)/2)Attendu:
X = 0 ; X = 1 ; X = 2 ...
| ?- L=[_|L], term_variables(L,Vs), L == Vs. **boucle**Attendu: échec.
iso_dif(X, Y) :- X \== Y, ( X \= Y -> true ; throw(error(instantiation_error,iso_dif/2)) ).C'est presque le vrai dif. Et dans les cas difficiles, on met
instantiation_error
| ?- A= -2,B= -3,fd_domain([A,B],-3,3),#\A#=B,A= -2,B= -3. A = -2 B = -3 yes | ?- fd_domain([A,B],-3,3),#\A#=B,A= -2,B= -3. no
| ?- fd_domain([D,E,F],0,1),fd_domain([B],1,2),fd_labeling([B]),B#=2*D*(E-F),B = 2. B = 2 D = 1 E = 1 F = 0 (88050 ms) yes
| ?- fd_domain([A,D],0,1),A#==>0#>max(0,-1*D),fd_labeling([A,D]), v(0,1)=v(A,D). no | ?- v(0,1)=v(A,D), fd_domain([A,D],0,1),A#==>0#>max(0,-1*D),fd_labeling([A,D]), v(0,1)=v(A,D). A = 0 D = 1 yes
| ?- v(0,0)=v(A,D), fd_domain([A,D],0,1),A#==>0#>0/D,fd_labeling([A,D]), v(0,0)=v(A,D). A = 0 D = 0 yes | ?- fd_domain([A,D],0,1),A#==>0#>0/D,fd_labeling([A,D]), v(0,0)=v(A,D). no
ulrich@p0:/opt/gupu/src/gprolog-code/src$ date; git pull ; date Wed Feb 5 19:40:23 CET 2014 Already up-to-date. Wed Feb 5 19:40:23 CET 2014 ulrich@p0:/opt/gupu/src/gprolog-code/src$ git describe v1.4.2-git-82-g97967e9Pourqoui 1.4.2? Nous avons 1.4.4+. 2+ : ajouter cette identification
| ?- Y = 1, X #= Y*Y*Y. X = 1 Y = 1 yes | ?- X #= Y*Y*Y. no
Portability:
Deprecated
variable_names(VNL): VNL is unified with the list of pairs Name = Var where Var is a named variable of the term and Name is the atom associated with the name of Var. Anonymous variables are not included in the list VNL. The pairs appear in in left-to-right traversal order of their Var in the term.
| ?- v(A,B,C)=v(2,1,1), min(A,B)#>C. no | ?- fd_domain([B,C],0,2),(A=0;A=2),min(A,B)#>C, v(A,B,C)=v(2,1,1). A = 2 B = 1 C = 1 yes
| ?- fd_domain([B],1,2),fd_domain([C],-1,0),2#>B/C,fd_labeling([C]). Floating point exception (core dumped)
cd src ./configure..... make tu compiles la donc, tu fais: cd ../doc make all Et ensuite tu finis l'installation: cd ../src make installmake install. ter.
div
et mod
n'est sont pas bien definie. Avant tout, il sont
les opérations
préférées. LIA-1
ne fait pas un mystère. Il faut:
Expression | Result = eval(Expression) | Signature | ISO |
E1 // E2 | tr(x/y) no longer specified by any part of LIA (ISO/IEC 10967) | ||
E1 rem E2 | ... no longer specified by any part of LIA (ISO/IEC 10967) | ||
div | ⌊x/y⌋ as defined by LIA-1 ISO/IEC 10967-1 | ||
mod | x - (⌊x/y⌋ ⋅ y) as defined by LIA-1 ISO/IEC 10967-1 | ||
avec (selon 4.1.3.4) tr(x) = if x ≥ 0 then ⌊x⌋ else -⌊-x⌋
à savoir: integer_rounding_function
est
toujour toward_zero
. Si tu mi ça en question, alors tu
n'a que des troubles. Il n'y a aucune implantation Prolog
avec down
.
| ?- catch(open(foo,write,_,[type(_)]),error(E,_),true). E = domain_error(stream_option,type(_))Attendu: instantiation_error. Oui, c'est pas tout a fait évident. Mais, selon 7.12.2 a:
a) There shall be an Instantiation Error when anet en même temps 8.11.5.1:
argument or one of its components is a variable, and an
instantiated argument or component is required. ...
a) Opens the source/sink Source_sink for input oret plus généralement 7.12:
output as indicated by input/output mode Mode and the
list of stream-options Options (7.10.2.11).
7.12 ErrorsIdem pour: open (2x), close, write_term, read_term.An error is a special circumstance which causes the normal
process of execution to be interrrupted.The error conditions for each control construct and built-in
predicate are specified in the clauses defining them.Other error conditions are defined in this part of ISO/IEC
13211 where it states: "It shall be an error if ...".
C'est important aussi pour variable_names/1.
| ?- _ =.. [1|_]. uncaught exception: error(type_error(atom,1),(=..)/2)Attendu: instantiation_error selon 8.5.3.3 a.
| ?- op(400,yfx,[bop,b3p,op,o8p,xor,x_r]). yes | ?- writeq(0b3p 2). uncaught exception: error(syntax_error('user_input:17 (char:10) , or ) expected'),read_term/3) | ?- writeq(0bop 2). 0 op 2 yes
| ?- format('**~t~d~20|~n',[10]). ** uncaught exception: error(domain_error(format_control_sequence,t),format/2)attendu (B)
| ?- format('**~t~d~20|~n',[10]). ** 10L'origine de format/2 est Quintus. Et donc SICStus 4
ulrich@gupu2:~$ /opt/gupu/gprolog-1.4.1/bin/gprolog GNU Prolog 1.4.1 By Daniel Diaz Copyright (C) 1999-2012 Daniel Diaz | ?- ( ( !, fail ; X = 1 ) *-> Y = 2 ; Z = 3 ). Fatal Error: Segmentation ViolationMinimum:
| ?- !*->!. Fatal Error: Segmentation Violation
GNU Prolog 1.4.1 By Daniel Diaz Copyright (C) 1999-2012 Daniel Diaz | ?- write_term(V+_,[variable_names(['_18'=V])]). _18+_18Pas evident... Peut-être c'est bon comme ça.
| ?- X = s(X). (boucle)Attendu: quelque chose comme "cycles in answer". Tu peut donner une telle réponse facilement grâce à
acyclic_term/1
...
| ?- length(Vs,3), fd_domain_bool(Vs), fd_all_different(Vs). Vs = [_#0(0..1),_#19(0..1),_#38(0..1)] yesAttendu:
maybe
.
Une élaboration
sur SO sur ce thème. Donc il est bon de dire yes
si
il y a au moins une solution, comme:
| ?- length(Vs,3), fd_domain_bool(Vs). Vs = [_#0(0..1),_#19(0..1),_#38(0..1)] yes
ulrich@gupu2:/opt/gupu/src$ gprolog-1.4.1-20120430/src/TopComp/gprolog GNU Prolog 1.4.1 By Daniel Diaz Copyright (C) 1999-2012 Daniel Diaz | ?- A = (X=1), copy_term(A,B). A = (X=1) B = (_=1) yes | ?- ulrich@gupu2:/opt/gupu/src$ gprolog-1.4.1-20120430.1/src/TopComp/gprolog GNU Prolog 1.4.1 By Daniel Diaz Copyright (C) 1999-2012 Daniel Diaz | ?- A = (X=1), copy_term(A,B). (4 ms) no | ?- copy_term(A,B),write(ici),nl. ici no | ?- A=B. no | ?- A=A. noAttendu: Comme la version precedente de 11:02 !
^(int-exp, int-exp) = integer. Mais, malgré tout, on a aussi des lignes pour les floats. Ceci à facilité l'adaptation dans le rectificatif : Des maintes systèmes on eu (^)/2 — comme IF.
ulrich@gupu2:/opt/gupu/src$ diff gprolog-1.4.1-201204*/doc/pl-bips.tex 108c108 < and \texttt{callable/1} are ISO predicates. --- > \texttt{callable/1} and \texttt{ground} are ISO predicates.ground/1
868c871 < \texttt{+ E} & \textit{eval}(\texttt{E}) & IF $\rightarrow$ IF & rev \\ --- > \texttt{+ E} & \textit{eval}(\texttt{E}) & IF $\rightarrow$ IF & N \\Mais si !
7069,7070c7075,7076 > \texttt{maplist(Goal, List1, List2, \ldots, List$N$)} succeeds if \texttt{Goal} can succesfully be > applied to all $N$-uples ($N \leq 8$) of elements of \texttt{List1}..\texttt{List$N$}.On ne peut pas appliquer un but. C'est soit une continuation, soit un but partiel (donc partial goal per analogiam partial application). Cette formulaison est problématique : Plutôt succeeds if all call(Goal, X1, ... XN) succeed which/that .... Mais je suis couramment en train de trouver ce texte pour le prologue. Tu met l'accent sur le success. La norme sur la vérité et le déroulement au fur et à mesure. Ça commence avec Procedurally,
| ?- \+ \+ ( length(L,100000), maplist(=,L,K),subsumes_term(L,K) ). uncaught exception: error(representation_error(too_many_variables),call/3)Pourquoi call/3, c'est subsumes_term/2.
| ?- term_variables(1,1,1). yesPlutôt : term_variables(?term, ?term, ?term).
2+: term_variables/2 est ISO, term_variables/3 est GNU.
C'est un constat trop général. Il y a des cas d'utilisation trés utiles même pour GNU:acyclic_term(Term)
succeeds ifTerm
does not contain a cyclic (sub-)term. This predicate is provided for compatibility only. GNU Prolog does not support cyclic terms so the use of cyclic terms is not safe and the resulting behavior is undefined (most often this leads to an infinite loop and/or a system crash).
acyclic_term(Term)
succeeds ifTerm
does not contain a cyclic (sub-)term. In this case,Term
may be processed safely. Ifacyclic_term(Term)
fails,Term
contains a cycle and processingTerm
is not safe, because GNU Prolog does not support the unification of cyclic terms but permits their creation. Cycles can be safely undone by failing over their creation. The use ofacyclic_term/1
shall thus be reserved to protect critical predicates against cyclic terms.
<name=
avant 8.14.6. Couramment,
l'ancre se trouve après. Et donc on voir Templates comme
première ligne.
acyclic_term/1
n'est pas GNU Prolog
predicate mais ISO predicate.
2+: cherche varible.
| ?- maplist(=,L,[1,2,3]). L = [1,2,3] ? ; noAttendu: Aucun point de choix ! SWI, YAP, Jekejeke sont capable de supprimer ce point de choix inutile.
Voici une définition évitant des points de choix:
maplist(_, Xs, Ys) :- Xs == [], !, Ys = []. maplist(_, Xs, Ys) :- Ys == [], !, Xs = []. maplist(_, [], []). maplist(Cont, [X|Xs], [Y|Ys]) :- call(Cont, X, Y), maplist(Cont, Xs, Ys).
variable_names/1
comme option pour imprimer.
Voici le Projet de
rectificatif technique 3. Minerva a eu l'option depuis longue.
Voici, Minerva:
?- Opts = [variable_names(_)],read_term(X,Opts), write_term(X,Opts). f(This is Nice). f(This is Nice) Opts = [variable_names(['This' = _1735,'Nice' = _1809])] X = f(_1735 is _1809)
Voici, Jekejeke:
Jekejeke Prolog, Development Environment 0.9.2 (c) 1985-2012, XLOG Technologies GmbH, Switzerland ?- Opts = [variable_names(_)],read_term(X,Opts), write_term(X,Opts). f(This is Nice). f(This is Nice)Opts = [variable_names(['This' = _E, 'Nice' = _F])], X = f(_E is _F)
8.4.6 :subsumes_term(General, Specific) succeeds if Generic can be made equivalent to Specific by only binding variables in Generic.Plutôt: ... by binding variables in General leaving Specific unaffected.
The current implementation performs the unification (with occurs check) and ensures that the variable set of Specific is not changed by the unification (which is then undone). Note that this predicate fails in the presence of FD variables in Specific.Une implantation ISO sans test d'occurrence :
subsumes_term(General, Specific) :- term_variables(Specific, SVars), \+ \+ ( numbered_from(SVars, 1), General = Specific), \+ \+ ( numbered_from(SVars, 2), General = Specific).On peut remplacer les entiers par des identificateurs uniques. Le prédicat numbered_from/2 ne fait pas partie du prologue. Mais il est mentionné dans DTC2. L'ordre des arguments n'est pas idéal pour la programmation basée sur call/N. from_to_numbered(From, To, Numbered) est préférable.
| ?- atom_length([], -1). uncaught exception: error(domain_error(not_less_than_zero,-1),atom_length/2) | ?- length([], -1). no | ?- length(L, -1). noAttendu:
domain_error(not_less_than_zero,-1)
2+: la doc 8.20.9 length/2 ne contient pas des erreurs...
| ?- read_from_chars("c. d",T). T = cPas sur, si c'est bon. Une différence des listes serait mieux.
a-->{throw(bon)}.
on a :
| ?- phrase(a,[]). uncaught exception: bon | ?- phrase(a,[a]). noAttendu : erreur bon.
| ?- phrase(\+[1],[]). uncaught exception: error(existence_error(procedure,(\+)/3),phrase/2)Attendu : Succès. Attention : Pour le moment il n'y a aucun document fiable pour les grammaires. Voir Comments on DCGs draft 2010-07-18, Comments on DCGs draft 2010-04-01.
| ?- X is min(2+0,1+1). X = 2 yes | ?- min_list([1+1,2+0],M). M = 1+1 yes | ?- min_list([2+0,1+1],M). M = 2+0mais selon le manuel:
min_list(+list, ?number)
.
2+ min_list
n'utilise pas min/2
. (Aussi, le nom
n'est pas idéal).
','(+callable_term,
+callable_term)
. Attendu : goal
. Si
non, (fail,_)
doit donner une erreur.
| ?- catch(read(X),error(E,_),true). 10000000000000000000. E = syntax_error('user_input:51 (char:1) integer overflow (exceeds max_integer)')Attendu :
representation_error(max_integer)
comme B. XSB
affiche un "warning" et donne le max_integer. Mais c'est pas
tellement claire, comme il n'y a aucune erreur pour les virgules
flottantes comme 1.0e1000000
ou 1.0e-1000000
.
Attendu : soit| ?- X is 7^7^7.X = 0 | ?- X is 0x0fffffff+1.X = -268435456| ?- X is 0x0fffffffffffffff+1. X = -1152921504606846976 yes
evaluation_error(int_overflow)
,
soit representation_error(max_integer)
. Il n'y a que | ?- \+ \+ (length(Xs,N),N=10000). (908 ms) yes | ?- \+ \+ (length(Xs,N),N=100000). (91025 ms) yesAttendu : linéaire, mais c'est quadratique. La définition Prolog dans src/BipsPl/list.pl est linéaire mais sous commentaires !
| ?- X = 1.0e120. X = 9.9999999999999998e+119C'est bien correcte comme la relecture produit la même valeur, mais il est tellement plus lisible de voir la représentation plus compacte dans SWI où SICStus. Des autres systèmes sauf GNU, SICStus, SWI ne respectent pas la propriété 7.10.5c par. 2.
| ?- phrase((""|""),Xs). uncaught exception: error(existence_error(procedure,('|')/4),phrase/3)Attendu :
Xs = [] ; Xs = []
.
| ?- X is 0'\ +'1. */ . */ . */ . */ .Il y a deux problèmes : 1mo #213. 2do le fait qu'on est dans un état où on peu taper
*/ .
sans cesse ! C'est
ne pas bon ! Dans beaucoup des applications on met les caractères
['\n','\n','.','\n']
pour synchroniser les
entrées/sorties. Récemment Richard O'Keefe m'a indiqué que ça ne
fonctionne pas avec des commentaires. Il a eu raison, enfin, il faut
faire plutôt [*,/,'\n','.','\n']
. Mais il faut vraiment
être capable de synchronizer ! Pour beaucoup des applications
Control-C n'est pas une option.
| ?- set_prolog_flag(strict_iso, off). yes | ?- current_predicate(false/0). yes | ?- current_predicate(fail/0). noD'où cette différence? Je ne vois pas un justificatif pour ça.
strict_iso
est problématique.
current_predicate/1
?IF, SWI, YAP, B, SICStus,
XSB donnent type_error(predicate_indicator, fail)
pour le
but current_predicate(fail)
seul GNU (strict_iso off) et
Ciao échouent.
current_predicate/1
demande pour
les prédicats prédéfinis et les CC. Mais je suis irrité par 13211-2
6.6.3. Cette procédure est tellement diffèrente de 13211-1 7.7.7. Il
faut relire les deux en même temps.
| ?- (X,Y). uncaught exception: error(instantiation_error,top_level/0) | ?- [user]. (a,b) :- c. compiling user for byte code... user:1: warning: suspicious predicate (',')/2 user compiled, 2 lines read - 206 bytes written, 4507 ms yes | ?- call((X,Y)). uncaught exception: error(instantiation_error,top_level/0) | ?- call(',',X,Y). uncaught exception: error(existence_error(procedure,c/0),(',')/2)Attendu : instantiation_error. Justificatif : dans l'article 8.15.4.1 call/2,... utilise finalement un seul but call/1 (b).
| ?- Ch = (a = b). Ch = (a=b) yes | ?- Ch = = . uncaught exception: error(syntax_error('user_input:12 (char:6) current or previous operator needs brackets'),read_term/3) | ?- Ch = (=) . Ch = =Attendu :
(=)
(Evidement hors du domaine d'application de 13211-1.)
| ?- compare(>=, 3, 3.0). noAttendu: domain_error(order, >=). Voir: 8.4.2.3
| ?- keysort([],[a]). noAttendu: type_error(pair,a). Justificatif : Article 8.4.4.3 f la demande.
| ?- portray_clause(a), portray_clause(b). a.b.Attendu:
a. b.Comme SWI, YAP, B, SICStus, Ciao.
| ?- op(0, xfy, ['|']). uncaught exception: error(permission_error(create,operator,'|'),op/3)Attendu: Succès.
| ?- term_variables(A+B*C/B-D,Vars). Vars = [D,C,B,A]Attendu:
[A,B,C,D]
Raison: Il faut des points fixes!
Définition.
ulrich@gupu2:~/iso-prolog$ /opt/gupu/gprolog-1.4.0/bin/gprolog GNU Prolog 1.4.0 By Daniel Diaz Copyright (C) 1999-2010 Daniel Diaz | ?- write_canonical(f(-1)). f(-1) yes | ?- op(0,fy,-). yes | ?- write_canonical(f(-1)). uncaught exception: error(syntax_error('user_input:3 (char:20) , or ) expected'),read_term/3)Recommandé : suivre la norme ISO. C.a.d:
-1 = - 1.
| ?- X is max(10000000000000,1.0). X = 1.0
ulrich@gupu2:~$ /opt/gupu/gprolog-1.4.0/bin/gprolog GNU Prolog 1.4.0 By Daniel Diaz Copyright (C) 1999-2010 Daniel Diaz | ?- [user]. uncaught exception: error(system_error('error trying to execute pl2wam (maybe not found)'),consult/1)
| ?- catch(X is-1**1.5,error(E,_),true). X = nanAttendu:
E = evaluation_error(undefined)
| ?- Xs=[a|Xs],atom_chars(A,Xs). Fatal Error: Segmentation ViolationAttendu:
type_error(list,Xs)
. C'est STO, donc c'est pas normatif.
| ?- set_prolog_flag(strict_iso,on). yes | ?- X is asin(2). X = nan yesAttendu: evaluation_error(undefined). Idem pour acos/1. Dans un modus strict, il faut jamais des valeurs comme nan.
term_variables(Term, Variables) :- type_test_list_or_partial_list(Variables), term_variables(Term, Variables, []).
acyclic_term(_).
op(400, yfx, div).
div(X, Y, Z) :- Z is (X - X mod Y) // Y.
op(Priority, Op_specifier,
Operator)
, ajouter permission_error(create,
operator, Operator)
dans des situations suivantes:
Operator
égal à '[]'
, '{}'
.
Operator
égal à '|'
et Op_specifier
n'est pas infix.
Operator
égal à '|'
et Op_specifier
est infix, mais Priority
inférieure à 1001.
type_error(variable,Culprit)
par uninstantiation_error(Culprit)
selon cette définition. [[C'était
plutôt une surprise. Avant la session on a bien préféré
freeness_error. Mais les arguments contre freeness ont surgit.]]
(><)/2
par xor/2
sans
opérateur prédéfini. [[Personne a aimé l'opérateur stile bow-tie.
Ça suggère trop une comparaison.]]
| ?- [user]. compiling user for byte code... c :- X*Y#=2, X=Y. user compiled, 2 lines read - 374 bytes written, 17165 ms yes | ?- c. yesAttendu : Réponse conditionnelle. Par ex.
maybe
à
la place de yes
.
C'est
très confondrant pour les débutants.
Ou bien plus détaillé, des prédicats copy_term/3 et
call_residue_vars/2.
| ?- X=0+0, 0#=X. X = 0+0 yes | ?- 0#=X, X=0+0. noC'est un problème de tout les solveurs CLPFD. La commutativité n'est pas respectée. En SICStus, la première requête donne une erreur de typage, mais
X=0+0, call(0#=X).
est un succès. Ceci n'est
pas préférable d'un point de vue sémantique. C.a.d échanger une
erreur de typage par un succès. En SICStus, maplist(#<(X), Xs) se
comporte donc différemment d'un prédicat récursif correspondant.
J'aimerai bien d'avoir des contraintes munies des propriétés
algébriques. C'est Programmation en logique — et non
Programmation sans logique.
| ?- P #= X*X, X = 16384. no | ?- X = 16384, P #= X*X.Attendu: Selon 13211-1, 7.12.2 f, Representation Error.P = -268435456X = 16384 yes
ulrich@gupu2:/opt/gupu/src/gprolog-1.4.0/src$ /opt/gupu/gprolog-1.4.0/bin/gprolog GNU Prolog 1.4.0 By Daniel Diaz Copyright (C) 1999-2010 Daniel Diaz | ?- length(L,L). L = 1 ? ; L = 2 ? ; L = 3 ? ; Fatal Error: Segmentation Violation ulrich@gupu2:/opt/gupu/src/gprolog-1.4.0/src$Attendu : boucle infinie
GNU Prolog 1.4.0 By Daniel Diaz Copyright (C) 1999-2010 Daniel Diaz | ?- [user]. compiling user for byte code... a-->"". user compiled, 2 lines read - 228 bytes written, 3801 ms yes | ?- phrase(a,L). uncaught exception: error(existence_error(procedure,a/2),phrase/2)
522 make distclean 523 ./configure --prefix=/opt/gupu --disable-regs --with-c-flags=debug 524 make 525 make installégalement:
| ?- [user]. compiling user for byte code... a(1,2). user compiled, 2 lines read - 240 bytes written, 5845 ms yes | ?- a(X,Y). uncaught exception: error(existence_error(procedure,a/2),top_level/0)
make[1]: Entering directory `/opt/gupu/src/gprolog-1.4.0/src/Pl2Wam' make[1]: `pl2wam' is up to date. make[1]: Leaving directory `/opt/gupu/src/gprolog-1.4.0/src/Pl2Wam' make[1]: Entering directory `/opt/gupu/src/gprolog-1.4.0/src/Fd2C' gplc -c --fast-math fd2c.pl Fatal Error: Segmentation Violation compilation failed make[1]: *** [fd2c.o] Error 1 make[1]: Leaving directory `/opt/gupu/src/gprolog-1.4.0/src/Fd2C' make: *** [all] Error 1 ulrich@gupu2:/opt/gupu/src/gprolog-1.4.0/src$ history 502 wget http://gprolog.univ-paris1.fr/unstable/gprolog-20100622.tgz 503 tar tfz gprolog-20100622.tgz 504 ls 505 rm -fr gprolog-1.4.0 506 tar xfz gprolog-20100622.tgz 507 cd gprolog-1.4.0/ 508 ls 509 cd src 510 ls 511 ls -ltra 512 find -type f -mtime -3 513 ./configure --prefix=/opt/gupu 514 make 515 historyFonctionne avec --with-c-flags='-O'
gplc -c consult.wam line 10: atom expected predicate('$use_consult'/0,29,static,private,built_in,[ ^ here Translation aborted compilation failed make[1]: *** [consult.o] Error 1 make[1]: Leaving directory `/opt/gupu/src/gprolog-1.4.0/src/BipsPl' make: *** [all] Error 1 ulrich@gupu2:/opt/gupu/src/gprolog-1.4.0/src$
| ?- phrase(NT,Xs). Fatal Error: global stack overflow (size: 32768 Kb, environment variable used: GLOBALSZ)Attendu: instantiation_error.
| ?- op(100,xfx,[]). yes | ?- G = 1 '[]' 2. G = 1 [] 2 yes | ?- G = 1[]2. uncaught exception: error(syntax_error('user_input:2 (char:6) . or operator expected after expression'),read_term/3) | ?- G = 1[ ]2. uncaught exception: error(syntax_error('user_input:4 (char:6) . or operator expected after expression'),read_term/3) yesAttendu selon la norme 13211-1:1995 : substitution réponse. C'est bien bizarre et je ne suis pas sur si cette conséquence représente l'intention de WG17. La conséquence est le comportement suivant :
| ?- G = (a-[]). uncaught exception: error(syntax_error('user_input:7 (char:9) current or previous operator needs brackets'),read_term/3)Il est souvent le cas qu'on utilise (-)/2 pour des tuples. Idem pour
{}
.
| ?- current_op(Pri,Fix,'|'). noAttendu: Fix = xfy, Pri = 1105 - comme par exemple SWI, YAP. En ce qui concerne 13211-1 c'est pour le moment une extension spécifique d'une implantation (3.92), mais qui est conforme à 5.5.2. La différence entre la priorité '|' et ; s'explique par l'utilisation de | pour des opérateurs commit.
make[1]: Leaving directory `/opt/gupu/src/gprolog-1.3.2/src/Pl2Wam' make[1]: Entering directory `/opt/gupu/src/gprolog-1.3.2/src/Fd2C' gplc -c --fast-math fd2c.pl Fatal Error: Segmentation Violation compilation failed make[1]: *** [fd2c.o] Error 1 make[1]: Leaving directory `/opt/gupu/src/gprolog-1.3.2/src/Fd2C' make: *** [all] Error 1 ulrich@gupu2:/opt/gupu/src/gprolog-1.3.2/src$ uname -a Linux gupu2 2.6.31-15-generic #50-Ubuntu SMP Tue Nov 10 14:54:29 UTC 2009 i686 GNU/Linux ulrich@gupu2:/opt/gupu/src/gprolog-1.3.2/src$ history|tail 531 cd src 532 cd gprolog-1.3.2/ 533 ls 534 less INSTALL 535 du 536 cd src 537 ./configure --prefix /opt/gupu/gprolog-1.3.2 538 make 539 uname -a 540 history|tail ulrich@gupu2:/opt/gupu/src/gprolog-1.3.2/src$ ls -l config.log
| ?- call(functor(F,c),0). uncaught exception: error(type_error(integer,c),functor/3)Expected:
F = c