Friday, December 19, 2008

A small peeve

Whenever I write a function with an external wrapper and an internal recursive function (say, to add an accumulator), I can never come up with a name for the internal function that I find satisfying. This is totally picking nits, but it bugs me for all the recursive calls to be to foo/aux or foo/helper or something like that. Come to think of it, somehow the prime symbol in Haskell and ML feels more natural.

21 comments:

Unknown said...

OTOH efficient implementation of optional parameters (I don't know how efficient mzscheme is) should allow you to use one name for both versions (and even allow different accumulator seeds when needed)

Dave Herman said...

An optional argument isn't always the right solution. In one case I have a function that needs to transform its argument in a particular way only once at the beginning; an extra boolean flag indicating whether this had been done yet would be overkill.

Robert said...

I usually use underscore as the name for these functions.

Anonymous said...

I like using gerunds for this. Like the internal loop for the 'mung' function is 'munging'.

Dan Villiom Podlaski Christiansen said...

I generally use ‘visit’ for that purpose; it's nice and functional, and clearly conveys the intent of the function. To me, it seems as natural as naming an accumulator ‘acc’ and a continuation ‘c’; I wouldn't use the names for anything else.

Mitch Wand said...

Dan usually writes foo^ as the nearest Scheme equivalent to foo' .

I've also used foo-loop or foo-inner.

Interesting how the smallest things get the most comments :-)

grant rettke said...

If you think of those internals as private, foo/private makes sense.

If you are using PLT's module system, then name the public functions foo/public and rename them on export. You can keep your code looking how you want privately and publicly.

Mike Machenry said...

Oh I relate to this a lot. The same issue also often exists with the argument to the external and internal function.

I've gone through a lot of phases in my life. Currently I've been doing _foo. It used to be just aux, before that: foo-aux, and others. I could never settle.

Actually I very often just write let-loop to avoid the naming issue. Then there was the most misguided of all, utilizing the fact that internal definitions shadow the external function.

-mike

Andrey Fedorov said...

The Seasoned Schemer uses upper-case one-letter names, which helps remind you that the function is very local.

This seemed weird at first, but seems to be working out.

Norton Setup said...

Thanks for Sharing. I am glad to know that I follow your blogs. it was very interesting. keep posting!

Install Norton Antivirus in your PC's and mobile to protect your systems from viruses.

norton setup with key
enter norton product key code to activate
Norton setup
norton.com/setup
www.norton.com/setup
norton setup enter product key

malina smith said...


Norton™ provides industry-leading antivirus and security software for your PC, Mac, and mobile devices Visit @: - McAfee.com/activate | Norton.com/myaccount | norton.com/setup

antivirusnorton said...

Enter Key Norton Setup, after purchasing Norton from visit norton.com/setup, sign in to your Norton account then enter product key for Norton Install.

norton setup |
mcafee.com/activate |
office.com/setup |

Deam jones said...

Norton Security Deluxe is new applications that have all the qualities of Norton antivirus with some extra services.
norton.com/setup
office.com/setup
office.com/setup
norton.com/setup
norton.com/setup
norton.com/setup

Anonymous said...

If your purchase of ms-office.com/setup came with a product key, you enter your product key on one of the websites listed below for your version of Office. After you enter your key, you can download and install Office, or you can renew your Office 365 subscription. office.com/setup ||
www.office.com/setup||
www.office.com/setup

norton.com/setup said...

I really happy found this website eventually. Really informative and inoperative, Thanks for the post and effort! Please keep sharing more such blog.

norton.com/setup

norton.com/setup

norton.com/setup

kaspersky activation code

free pogo games

roadrunner email

aol mail

office.com/setup said...


office setup is the software setup file with this setup file you can install on your PC and some of the supported device to make use of office setup. Not only the
office.com/setup but all the software for all time has the setup file, and it is very significant, without the setup file the software turn ineffective
office setup
www.office.com/setup

Adam Jon said...

Microsoft Office setup is a must tool for any PC in this generation. It provide very userful tools like MS-Word, Excel and powerpoint which are essential for making your task very easy related to business. This feature makes Office.com/setup one of the best software package.

Office.com/setup
Webroot.com/safe

Mike Jones said...

It read your article every thing is clear , Thanks for sharing.

office.com/setup , mcafee.com/activate

norton.com/setup said...


I am very glad after reading your fantastic article , Thanks for sharing .

norton.com/setup

office.com/setup said...

yeah it is good that it should be written on external wrapper with the name of external through which they can get satisfy

GovtAssistances said...

does El Pollo Loco take EBT? The answer is no. As of the time of writing, El Pollo Loco does not accept EBT as a form of payment.