P
Pascal J. Bourguignon
Um, this is a recursive function. Inside PARENT, there is another call
to PARENT.
Feel free to derecursive it.
Um, this is a recursive function. Inside PARENT, there is another call
to PARENT.
You imply they want to keep their users ignorant of these structures, as if
to keep something valuable from them. Wouldn't it be more honest, more to
the point and much simpler to state they don't NEED the user to understand
recursive - or indeed any other - data structures? And that the user doesn't
NEED to understand or know about them, just to use them?
After all they are users. They use their system for fun, learning or work..
Even a very competent or advanced use of a tool (computer, car, mobile phone,
fridge, TV, radio, toilet) in no way implies an understanding of it's inner
workings. Nor the need, nor the desire.
PS: Isn't this thread much ado about nothing?
It starts with the misconception (or should I say confusion?) between
performing a recursive job and using a recursive tool to do it. And then it
blazes off in these huge discusions about semantics to define a definition
of an abstraction of a alleady theoretical problem.
Glorious, just frelling glorious.
We have an expression for that. But I'll avoid using it, since it has the
word 'masturbation' in it...
And PPS: the P(P)S's don't specifically refer to your posting.
Don't be sorry.
It's not tail recursion. If you had indented your code properly, you'd
see why it's not:
(defun dir-delete (directory)
(loop for entry in directory
do (if (is-a-directory entry)
(dir-delete entry))))
(I put parentheses, so my editor knows what I mean and can do the
indentation for me).
That's why walking a directory is done with a recursive procedure,
instead of an iterative one: it's much simplier. To implement an
iterative procedure, you would have to manage a stack yourself, instead
of using the implicit stack of the recursive procedure.
If you tell a joke, you have to tell it right.
Recursion: (N). See recursion. See also tail recursion.
[I agree with you Xah that recursion is a technical word that should not
be foisted onto lay users.]
Indeed. And the algorithms that are employed to perform the operationshttp://xahlee.org/comp/idiom_directory_recursively.html
------------------------------------------
English Idiom in Unix: Directory Recursively
Xah Lee, 2011-05-17
Today, let's discuss something in the category of lingustics.
You know how in unix tools, when you want to delete the whole
directory and all sub-directories and files in it, it's referred as
“recursive�
[...]
Though, if you think about it, it's not exactly a correct description.
“Recursiveâ€, or “recursionâ€, refers to a particular type of algorithm,
[...]
The "non-recursive delete" would be simply calling the rmdir() systemwould simply call "delete". Presumably the non-recursive delete is
called simply "delete" but is actually something more complicated than
delete, and you're supposed to know what that is.
In the emacs case: “Recursive delete of xx? (y or n) â€, what could it possibly mean by the word “recursive†there? Like, it might delete the
directory but not delete all files in it?
Recursion: (N). See recursion. See also tail recursion.
Feel free to derecursive it.
: On Thu, 19 May 2011 22:13:14 -0700, rusi wrote:
:
: > [I agree with you Xah that recursion is a technical word that should not
: > be foisted onto lay users.]
:
: I think that is a patronizing remark that under-estimates the
: intelligence of lay people and over-estimates the difficulty of
: understanding recursion.
Could we then say that «recursion is a technical word that should
not /unnecessarily/ be foisted onto lay users»?
However, some C compilers will *also* have one or more "go faster"largely on the properties of hardware that is now obsolete. With
modern processors there's no great efficiency hit. In some of the
smaller microcontrollers, it's true, you do have to worry about stack
overflow; but the ARM processors, for example, provide plenty of stack
space.
In the microcontroller world, the big performance hits come from the
fact that the only available compilers are for C and sometimes C++.
(And nobody uses assembly language except for the very little jobs.)
The nature of the C language prevents compilers from doing
optimisations that are standard in compilers for high-level languages.
Most C compilers will, for example, always pass parameters on the
stack, despite the generous supply of registers available in newer
hardware.
However, some C compilers will *also* have one or more "go faster"
calling conventions that pass parameters in registers, which can be
employed. Over in the PC world, such "go faster" calling conventions
are even the default calling convention if no calling convention is
explicitly specified, for some C and C++ compilers.
http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/function-calling-conventions.html#Compiler
http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/function-calling-conventions.html#Optlink
http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/function-calling-conventions.html#Watcall
Please include attributions, in this case for Peter Moylan and rusi!
2011-05-21 11:52, Lars Enderin skrev:
Just Peter Moylan, sorry!
In the microcontroller world, the big performance hits come from the
fact that the only available compilers are for C and sometimes C++.
(And nobody uses assembly language except for the very little jobs.)
The nature of the C language prevents compilers from doing optimisations
that are standard in compilers for high-level languages. Most C
compilers will, for example, always pass parameters on the stack,
despite the generous supply of registers available in newer hardware.
It might *try* to delete the directory but not any of its contents,
yes.
Xah wrote:
«In the emacs case: “Recursive delete of xx? (y or n) ”, what couldit
possibly mean by the word “recursive” there? Like, it might delete the
directory but not delete all files in it?
»
you mean theoretically you see a possibility if the dir is implement
as stilted as unix, but never in your life you find yourself might
want to do it?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.