I got you. And this was my point, "declarative" for me, means some declarations/restrictions about answer/answers. No exact algorithm: you can even don't know how this is evaluated/executed. You only find some relations and declare them. And set of solvers tries to find solutions. So, modern Prolog/Logic systems are Prolog as DSL and set of solvers, right. For example, to find factorial as well as it's argument, you need to implement CLP library in Haskell explicitly (if you want to use CLP way). This is the Haskell tradition. Sure, you can do it in Python, in C (sure, such libraries already exist). But it's not declarative tradition: predicates calculus is based on backtracking and variables unification. Haskell, like Scheme is based on lambda calculus. So, evaluation is totally different.Hmm, but CLP has completely different way of evaluation and program construction than Prolog has. Moreover, stating it is a Prolog is not so much true then. That's the point as I can see it.
And it has nothing to do with Haskell extensions. In Haskell, the principle remains the same, though.
Dušan
On pondělí 9. července 2018 10:22:15 CEST you wrote:
> Hello, Dušan!
>
> > This is not Prolog, it is a Prolog with CLP extension over integers.
>
> as well as Haskell has a lot of extensions. I mentioned CLP as solver
> but modern Prologs is not ISO only and has a lot of solvers (CHR,
> different CLP, FuzzyLogic, Tabulating, etc). Actually CLP(x) in included
> in most modern implementations.
>
> 09.07.2018 10:58, Dušan Kolář wrote:
> > Hello PY/Paul,
> >
> > You are using misleading arguments!
> >
> > This is not Prolog, it is a Prolog with CLP extension over integers.
> >
> > > factorial(0, 1).
> > >
> > > factorial(N, F) :-
> > >
> > > N #> 0,
> > >
> > > N1 #= N - 1,
> > >
> > > F #= N * F1,
> > >
> > > factorial(N1, F1).
> > >
> > >
> > >
> > > I can call it: factorial(5, X) => X=120.
> > >
> > > But also: factorial(X, 120) => X=5.
> >
> > Pure Prolog is:
> >
> > factorial(0, 1) :- !.
> >
> > factorial(N, F) :-
> >
> > NN is N - 1,
> >
> > factorial(NN, FF),
> >
> > F is FF * N.
> >
> > which is a function, not a relation, as you write.
> >
> > Dušan Kolář