|
From: | Paul Rubin |
Subject: | Re: How to cast an imperative loop into a readable recursive function ? |
Date: | Thu, 02 Dec 2010 19:30:00 -0800 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Katalin Sinkov <lispstylist@gmail.com> writes: > what I forgot to mention was that it should be possible to view the > subseries problem in a way that I dont have to go thru a loop but use > recursive definitions. The problem is still very confusing, but it sounds to me like maybe you want something like (untested): (defun foo (n str) (let ((s ...) (l ...) (p ...) ;; after reading the (s=2 l=4) prefix above, ;; p points past the end of it (if (< n l) (aref str (+ p n)) (foo (- n l) (substring str (+ p l)))))))
[Prev in Thread] | Current Thread | [Next in Thread] |