Re: Name For - Functions that indicate order?
- From: Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx>
- Date: Fri, 10 Aug 2007 18:31:48 +0200
Stone Free <spam_KillKillKillstone_freeNoSpamPleaseWereBritish@xxxxxxxxxxx> writes:
Hi,
I am writing the documentation for some of my code, and I want to name one
of my functions more correctly.
I have written a predicate that returns true if the left hand object comes
earlier in a sequence and false if not.
At the moment the function is called CompareItem, I am trying to come up
with a better name and a better description
It is used in two situations:
First as an argument to a sorting function, and so I could write
"Desc: Predicate used to sort entire vector". Of course it does
not actually sort anything it only indicates that the left hand
object does or does not come before the right hand object in the
sequence.
Secondly it is used as an argument to equal_range (C++ STL), and so
it is used to search for an item. and so I could write "Desc:
Predicate used to search for an item in a vector". Again the
function doesn't actually do the searching, and whilst it does do a
comparison, I want the name to imply that the function dictates the
ordering of the two items passed to it as arguments.
Or I could leave it at as:
Func: CompareItem
Desc: Compares two items and returns true if the left hand object comes
earlier in the sequence and false if not.
bool CompareItem(Item lhs,Item rhs);
Can anyone come up with a better name for the function, and better notes
for the documentation of the function?
The sequence defines an order, and this function IS the order relationship.
Recently I had to sort elements by some tags, given a tag order. So
obviously, I named the function TAG-ORDER.
(let ((tag-order (make-order-from-tags '(big middle small tiny))))
(sort items tag-order :key (function item-tag)))
--
__Pascal Bourguignon__ http://www.informatimago.com/
NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
.
- References:
- Name For - Functions that indicate order?
- From: Stone Free
- Name For - Functions that indicate order?
- Prev by Date: Re: Name For - Functions that indicate order?
- Next by Date: Re: Suggestions for Flexible GUIs?
- Previous by thread: Re: Name For - Functions that indicate order?
- Next by thread: Re: Name For - Functions that indicate order?
- Index(es):
Relevant Pages
|