Re: Lists in Learn Prolog Now
- From: "wooks" <wookiz@xxxxxxxxxxx>
- Date: 10 Jan 2006 00:54:28 -0800
Bart Demoen wrote:
> wooks wrote:
> > Lawrence Oluyede wrote:
> >
> >>Il 2006-01-06, wooks <wookiz@xxxxxxxxxxx> ha scritto:
> >>
> >>>I cannot reproduce the result asserted in section 4.3 of Learn Prolog
> >>>Now for
> >>>
> >>>a2b([a|Ta],[b|Tb]) :- a2b(Ta,Tb).
> >>
> >>You forgot to add
> >>
> >>a2b([], []).
> >>
> >>
> >>--
> >>Lawrence - http://www.oluyede.org/blog
> >>"Anyone can freely use whatever he wants but the light at the end
> >>of the tunnel for most of his problems is Python"
> >
> >
> > still doesn't work.
> >
> >
> > 1 ?- listing.
> >
> > a2b([a|A], [b|B]) :-
> > a2b([], []).
> > a2b([a|A], [b|B]) :-
> > a2b(A, B).
> >
>
> ... still didn't add the correct base fact, did you ?
>
I wasn't told it was a base fact and am not used enough to Prolog to
grok that was what was meant.
> Reread the post by Lawrence carefully, slowly, aloud, to your best
> friend and then type in what Lawrence suggested ...
> Alternatively, read the two clauses you currently have - aloud,
> declaratively etc.
> And/or reread the section 4.3 from the tutorial.
>
>
> Cheers
>
> Bart Demoen
I read it several times before posting and a few times again after.
Either I am stupid , or this is a very unnatural and awkward syntax to
grasp.
I have a much better than average understanding of recursion (which is
what is going on here) as I have read most of the Little Schemer. In
fact I could write this program in Scheme in seconds. The fact is even
having typed in the right thing and despite a crystal clear
understanding of the semantics of the solution I still don't really
understand how the syntax translates to implement semantics.
So if I may I would suggest the latter is the problem here. Thank you
for trying to help but please don't patronise me.
.
- Follow-Ups:
- Re: Lists in Learn Prolog Now
- From: Bart Demoen
- Re: Lists in Learn Prolog Now
- References:
- Lists in Learn Prolog Now
- From: wooks
- Re: Lists in Learn Prolog Now
- From: Lawrence Oluyede
- Re: Lists in Learn Prolog Now
- From: wooks
- Re: Lists in Learn Prolog Now
- From: Bart Demoen
- Lists in Learn Prolog Now
- Prev by Date: Re: Lists in Learn Prolog Now
- Next by Date: Re: Lists in Learn Prolog Now
- Previous by thread: Re: Lists in Learn Prolog Now
- Next by thread: Re: Lists in Learn Prolog Now
- Index(es):