In article <firstname.lastname@example.org>,
colin howarth <co...@howarth.de> wrote:
> Hi, I'm just starting out with Scheme (and Lisp) and am going through TheIn a recursive algorithm, you have to handle the case where the
> Little Schemer.
> I'm confused, right at the beginning and wanted to ask, since this seems
> lat? is defined in the book as
> (define lat?
> This terminates with #t when l has become the empty list (and all its
> However, it also evaluates to #t if given the empty list to start with.
> But atom? is defined as
> (define atom?
> which says that x must not be null.
> My attempt at lat? was
> (define lat?
> which reads as "the first element is an atom and the rest is null, or a list
recursion bottoms out *before* doing the non-terminal processes. You're
doing them in the wrong order.
> [I've done a couple of days of Lisp where (car ()) => nil. In Scheme I don'tYou can type it as '().
> even know how to *type* an empty list yet, so I'm using (cdr '(a)) or (lambda
> () ())]
> So. If you've got this far, I suppose the question is should lat? return #tThe following should be true for any l1 and l2:
> for an empty list?
(eqv? (lat? (append l1 l2))
What if l1 or l2 is the empty list, how can you ensure the tautology?
This type of equation is how you generally figure out how to handle
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.