Home > Archive > Prolog > December 2006 > difference lists ad CLP(FD) exercises
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
difference lists ad CLP(FD) exercises
|
|
| Richard Szopa 2006-12-11, 7:10 pm |
| 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.
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
| |
| Jan Wielemaker 2006-12-11, 7:10 pm |
| On 2006-12-08, Richard Szopa <ryszard.szopa@gmail.com> 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
>
| |
|
| On 7 Dec 2006 19:19:17 -0800, "Richard Szopa"
<ryszard.szopa@gmail.com> wrote:
>
>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.
1. Download B-Prolog. It is free, and has very good CLP(FD) solver.
In "examples" directory you will find about 50 sample problems.
Majority of them are toy problems, but some of them are quite
serious.
2. Download Eclipse. It is free, and is all about constraint
programming. Documentation provides excellent tutorial on solving
problems using CLP(FD), and there are a lot of examples. Book is in
print about using Eclipse for constraint programming; will be
published soon (Amazon still says that book has been not published
yet)
A.L.
| |
| Joachim Schimpf 2006-12-13, 4:16 pm |
| A.L. wrote:
> 2. Download Eclipse. It is free, and is all about constraint
> programming. Documentation provides excellent tutorial on solving
> problems using CLP(FD), and there are a lot of examples. Book is in
> print about using Eclipse for constraint programming; will be
> published soon (Amazon still says that book has been not published
> yet)
Regarding the ECLiPSe book by Apt/Wallace: I have received
my copy today, and it is already available from amazon.co.uk.
It seems the rest of the world may have to wait until after
Christmas. Pity, it makes an ideal present :-)
-- Joachim
| |
| Cesar Rabak 2006-12-13, 4:16 pm |
| Joachim Schimpf escreveu:
> A.L. wrote:
>
> Regarding the ECLiPSe book by Apt/Wallace: I have received
> my copy today, and it is already available from amazon.co.uk.
> It seems the rest of the world may have to wait until after
> Christmas. Pity, it makes an ideal present :-)
>
>
Joachim,
It can be outfoxed with gift certificates!
| |
| bart demoen 2006-12-13, 4:16 pm |
| On Wed, 13 Dec 2006 19:12:52 +0000, Joachim Schimpf wrote:
> Regarding the ECLiPSe book by Apt/Wallace: I have received
> my copy today, and it is already available from amazon.co.uk.
> It seems the rest of the world may have to wait until after
> Christmas. Pity, it makes an ideal present :-)
Just so that the rest of the world doesn't feel too bad compared to the
UK ... one of my colleagues received the book several days ago :-)
Cheers
Bart Demoen
| |
|
| On Wed, 13 Dec 2006 19:12:52 GMT, Joachim Schimpf
<j.schimpf@crosscoreop.com> wrote:
>A.L. wrote:
>
>Regarding the ECLiPSe book by Apt/Wallace: I have received
>my copy today, and it is already available from amazon.co.uk.
>It seems the rest of the world may have to wait until after
>Christmas. Pity, it makes an ideal present :-)
>
I got e-mail from Amazon: delivery date January 5th...
A.L.
| |
| Richard Szopa 2006-12-16, 10:04 pm |
| I finally lost hope that someone will point me to a set of 250
difference-list exercises of varying difficulty, with rot13-ed
answers, which Google has ignored. :-)
Anyway, great thanks to Jan Wielemaker and A.L. I've already started
using DCG, and I plan to read the Eclipse tutorial during the coming
holiday season.
Cheers,
-- Richards
| |
|
| On Sun, 17 Dec 2006 04:39:27 +0100, Richard Szopa
<ryszard.szopa@gmail.com> wrote:
>I finally lost hope that someone will point me to a set of 250
>difference-list exercises of varying difficulty, with rot13-ed
>answers, which Google has ignored. :-)
Sorry for not pointing you to web page with 250+ examples of
difference lists. According to my (limited) knowledge, such page
doesn't exist. Most likely, difference lists are not considered as
a) difficult, b) important.
Reasonable text about difference list you can find in (absolutely
excellent) book "Clause and Effect: Prolog Programming for the
Working Programmer" by William Clocksin. There is whole chapter
about difference lists, and presentation is very good (warning:
chapter is short :)
Prototype of this book (incomplete) you can find here
http://www.cl.cam.ac.uk/Teaching/2001/PrologAI/cae1.pdf
Fortunately, chapter on difference lists is included.
A.L.
|
|
|
|
|