Re: lexical question - recursion, capitalizing names

Subject: Re: lexical question - recursion, capitalizing names
From: Fred M Jacobson <fred -at- BOOLE -dot- COM>
Date: Tue, 29 Jun 1993 13:47:25 PDT

> ...
> Also, in some languages, functions are recursive - you can use a
> function in an expression that is an argument for the same function. I
> don't think you can do that with routines, though I've been wrong
> before. This, of course, is language dependent.

> If I were you, I'd refer to the function without the parens. Our written
> style calls for capitalizing language elements named in sentences, but
> this is up to you. ...

> |Len Olszewski


It is not recursion when the value of a function invocation is the argument
(or parameter) of another invocation of the same function. For example,

frthrt = sqrt(sqrt(x))

This is just nested calls to the function. Of course, you cannot do this
with a subroutine because it does not return a value to use as an argument.
The _Dictionary of Computing_ defines recursion as "the process of defining
or expressing a function, procedure, language construct, or the solution to
a problem in terms of itself..." So both functions and procedures can be
recursive. For example:

function factorial(i)
if i > 1 then
return i * factorial(i - 1)
return 1

procedure printlist(list)
print item(list)
if next(list) <> null then

The function says, "If the argument is greater than one, return the product
of the argument and the function called on one less than the argument.
Other wise, return one."

The procedure says, "Print the current item on the list. If there are more
items on the list, print the rest of the list."

Of course, the examples aren't in any particular language, but recursion is
available in many.

Regarding "capitalizing language elements," at least one popular language
(the C programming language) is case-sensitive, so this is not generally
possible. (I prefer using boldface to distinguish keywords, names of
functions, and the like, but some writers I have worked with think this
puts too much bold on a typical page and makes it harder to read. I

INTERNET: fred -at- boole -dot- com PHONE: (408) 524-3292 FAX: (408) 730-0558
USPS: Fred Jacobson / Boole & Babbage / 510 Oakmead Pkwy / Sunnyvale CA 94086

Previous by Author: HUMOR: Spelling Simplification
Next by Author: Re: Usage question
Previous by Thread: Training Institutes???
Next by Thread: Re: lexical question - recursion, capitalizing names

What this post helpful? Share it with friends and colleagues:

Sponsored Ads