Re: difference lists ad CLP(FD) exercises



On 2006-12-08, Richard Szopa <ryszard.szopa@xxxxxxxxx> wrote:
Hello,

I have been learning Prolog for a few months and I think I like it.
However, there's one thing I still find really difficult: difference
lists. I have read the appropriate chapters in Bratko and Art of
Prolog, so I quite understand the concept, and I am able to solve my
Prolog-class difference-lists homework. However, I do it with a lot of
trial-and-error, and I tend to be very surprised that my predicate
actually works -- I don't feel really comfortable using difference
lists and I rather avoid them in my own programs. I recognize this
isn't good and I'd like to change it.

Difference lists is always a bit nasty typing. They took me quite a
while before I could write them with little effort. If you need only one
though, consider using grammar rules. They effectively provide syntactic
sugar over a difference list. There is really no reason to limit the use
to parsing. They are great for `un-parsing' as well as for general list
processing involving one difference list.

Success --- Jan

I have a similar problem with CLP(FD)---I feel the lack of toy problems
that would allow me to get used to the CLP way of thinking.

Could anybody recommend me some sort of exercise set concerning
difference lists and CLP(FD)? I've searched the web but I haven't found
anything really interesting.

Thanks in advance,

-- Richard

.



Relevant Pages

  • Re: This Logo program in Prolog?
    ... Term is the basic data structure of Prolog, ... easily use a compound term for building many of the other data ... including lists (lists are just compound terms ... only other language I've seen with such love for the list type is ...
    (comp.lang.prolog)
  • Re: This Logo program in Prolog?
    ... Term is the basic data structure of Prolog, ... easily use a compound term for building many of the other data ... including lists (lists are just compound terms ... only other language I've seen with such love for the list type is ...
    (comp.lang.prolog)
  • Re: This Logo program in Prolog?
    ... I am such a beginner to Prolog that I did not think of using member ... Make more constructs/predicates part of the language or not? ... will iterate over the list of elements, ... I hate lists. ...
    (comp.lang.prolog)
  • Re: compare element in a list prolog
    ... exercises using lists, but not give them the very basic vocabulary of lists. ... If someone has gone to the bother of explaining Prolog to the point that the ... > suggest is that that skill is the essence of Prolog programming and, ... novices *do* find it difficult. ...
    (comp.lang.prolog)
  • Re: can we OR the clauses for satisfying the rule??
    ... > I am a network programer trying prolog for leisure and analysing its ... > use in network scenerios. ... > returns true if router X occurs in the route from the origin router to ... to think in terms of "lists of lists", ...
    (comp.lang.prolog)