7 ms·
To be explicit, the old Lisp convention I know of, which is not a super common one but one I've definitely used quite a bit, is that you might name a slightly l
by jjwiseman 9y ago
To be explicit, the old Lisp convention I know of, which is not a super common one but one I've definitely used quite a bit, is that you might name a slightly lower-level/more primitive version of a function with a %-prefix.
So if we have a user-email function that is just an object slot accessor, We could have %user-email that actually does a database query. I can't remember for sure, but I wouldn't be surprised if I'd seen a double %%-prefix used, too.
You don't always want to put those functions in separate packages (traditionally in Lisp, packages are relatively heavyweight--e.g. an entire web server framework might have only one or two packages).
Another similar example might be the convention of defining a macro with the name my-macro, and a function that actually implements much of the macro, or is an equivalent of the macro that takes a thnk, that is named my-macro*.
(24 years of lisp here--I wouldn't be surprised if the conventions of mainstream lisp during the earliest six years were somewhat different than the following decades.)
Edited to add: Now that I think about it, this convention may have been heavily used in the Macintosh Common Lisp community.
- vzcx 9y agoThank you, and thank you to the grandparent. It's quite fantastic to be schooled by old-time lispers (only 6 years of lisp here).
- kazinator 9y ago> Macintosh Common Lisp community. That's why I linked to some CCL code (descendant of MCL). I use foo-impl and such for the implementation of foo. If I have a my-macro, which is implemented by an expander function, then I call that function expand-my-macro.