From: ·····@km4u.net
Subject: Solution with constant space -- lisp exercise
Date:
Message-ID: <m2ae2poxd7.fsf@hal.local>
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