Anonymous user
Anonymous recursion: Difference between revisions
Prune {{incorrect}} tags. Ada, Common Lisp and UNIX Shell are incorrect (because the function is not anonymous), but there seems to be no fix.
(Prune {{incorrect}} tags. Ada, Common Lisp and UNIX Shell are incorrect (because the function is not anonymous), but there seems to be no fix.) |
|||
Line 26:
=={{header|Ada}}==
In Ada you can define functions local to other functions/procedures. This makes it invisible to outside and prevents namespace pollution.
Line 78 ⟶ 77:
=={{header|Common Lisp}}==
This puts a function in a local label. The function is not anonymous, but the name <tt>fib1</tt> is local and never pollutes the outside namespace.
<lang common lisp>
(defun fib (number)
"
(if (< number 0)
(error "Error. The number entered: ~A is negative" number)
Line 154 ⟶ 155:
"/home/uDTVwo/prog.fam" prog.__main__:22(PC:132)
</pre>
=={{header|Forth}}==
{{incorrect|Forth|
Recursion is always anonymous in Forth, allowing it to be used in anonymous functions.
<lang forth>defer fib
Line 606 ⟶ 608:
=={{header|UNIX Shell}}==
The shell does not have anonymous functions. Every function must have a name. However, one can create a subshell such that some function, which has a name in the subshell, is effectively anonymous to the parent shell.
|