Re: Newbie can't understand Prolog answer




"Jan Wielemaker" <jan@xxxxxxxxxxxxxxxxxxx> wrote in message news:slrnfpdv7f.268.jan@xxxxxxxxx
Possible some of the confusion is that Prolog isn't just a logical
language. It has side-effects and these are needed in many programs, for
example to write output. In the old days it would only print for
alternatives if it had an answer to a non-ground query. But people
complained that if you did

?- writeln(a) ; writeln(b).

It would write 'a' and 'Yes'. These people were confused too, and with
a reason.

Okay, that makes sense. I figured that side-effects were the ultimate reason. And you're right that I'm probably confusing Prolog with a pure logical language. I'm reading The Art of Prolog right now and the first chapters are all about idealized logical programming, and I'm guessing there may be divergences from actual Prolog.

-- Dave

.



Relevant Pages

  • Re: Controlling Javascript from server side
    ... but five different language implementations here. ... 'true' means that the request must be handled asynchronously. ... There is exactly *no* reason for such a thing here. ... | percent-endoded string). ...
    (comp.lang.javascript)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... overall familiarity with the tested platform, language or topic. ... The decrement happens BEFORE the assignment (simple ... Question 16 is trivial if you discount the possibility that the break ... Nor is there any reason why you couldn't use structs to implement a ...
    (comp.programming)
  • Re: Mainstreaming Prolog a Pragmatic Approach?
    ... experience is that Prolog is an incredibly useful language for virtually all ... often than not end up using Prolog. ... I think you're right when you question whether logic programming really ...
    (comp.lang.prolog)
  • Re: Islam was spread by the sword? What about Christianity?
    ... >No wonder Jews and Muslims both feel threatened by the Christian ... Here's the Pope making an address to academics in which he specifically ... And we see threats of violence - not reason - demands that the Pope ... language) is to go along with the emotive backlash reaction that the ...
    (uk.religion.christian)
  • Re: An even more basic question...
    ... My task was to represent these rules in Prolog, and to write an engine which, given a client's total position, could find the way of pairing its components so as to satisfy the rules with the minimum total margin requirement. ... present-day ISO Prolog is not co-extensive with the concept of Prolog -- and Prolog is not a "language" is the abusive sense in which that term is misapplied to deterministic stepwise-imperative computing notations. ... TOPIC: PROGRAMMING ... adapted to your particular scheduling problem, ...
    (comp.lang.prolog)