Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: comp.lang.python,comp.lang.lisp Subject: Re: English Idiom in Unix: Directory Recursively Date: Fri, 20 May 2011 02:38:39 +0200 Organization: Informatimago Lines: 28 Message-ID: <87pqnemcj4.fsf@kuiper.lan.informatimago.com> References: <87aaekoab7.fsf@kuiper.lan.informatimago.com> <8762p7omzu.fsf@kuiper.lan.informatimago.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net u1AEMQKkFx8N3kHelTKQVgPYux2M4amgIjqRF8FKJw+5IC2F+l Cancel-Lock: sha1:MWU0ODc5NTAyNjJkM2VhZjNiMjJmNWJiNTZiNDA1YjkwMzY4ZWIyMA== sha1:DxMoH72JQgoEwUwtuAKgGVmMqvI= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5799 comp.lang.lisp:3561 tar@sevak.isi.edu (Thomas A. Russ) writes: > "Pascal J. Bourguignon" writes: > >> tar@sevak.isi.edu (Thomas A. Russ) writes: >> > >> > This will only work if there is a backpointer to the parent. >> >> No, you don't need backpointers; some cases have been mentionned in the >> other answer, but in general: >> >> (defun parent (tree node) >> (if (member node (children tree)) >> tree >> (some (lambda (child) (parent child node)) (children tree)))) >> >> Yes, the question wasn't about time complexity. > > :-p > > Um, this is a recursive function. Inside PARENT, there is another call > to PARENT. Feel free to derecursive it. -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}.