Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Solution with constant space -- lisp exercise

1 view
Skip to first unread message

tr...@km4u.net

unread,
Jul 1, 2001, 4:39:53 AM7/1/01
to

Hi,

I am currently reading the well known book "Structure and
Interpretation of Computer Programs" (aka SICP) of
Abelson/Sussman. Unfortuntely there are no solutions for the exercise
in the book, nor could I find them on the web.

The following example is pretty easy to solve.

;;; Example 3.18 (page 207)

; Write a procedure that examines a list and determines whether it
; contains a cycle, that is, whether a program that tried to find the
; end of the list by taking successive cdrs would go into an infinite
; loop.

But I have no idea how this could be done.

;;; 3.19.

; Redo Exercise 3.18 using an algorithm that takes only a constant
; amount of space.(this requires a very clever idea.)


I'm sure that someone of you, dear fellow lispers, will come with a
bright idea.


Best regards

Martin

0 new messages