Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:46:29+00:00 2026-06-05T02:46:29+00:00

When I define a private function in Clojure, I usually use a – prefix

  • 0

When I define a private function in Clojure, I usually use a - prefix as a visual indicator that the function cannot be used outside of my namespace, e.g.

(defn- -name []
  (let [formatter (formatter "yyyy-MM-dd-HH-mm-ss-SSSS")]
    (format "fixjure-%s" (unparse formatter (now)))))

But the - prefix seems to also be a convention for public methods when using gen-class.

Is there any generally accepted convention for defn-‘d functions in the Clojure community, or should I simply use non-prefixed names?

It seems that lots of code in clojure.contrib (may it rest in peace) uses normal names for private functions, so maybe that is best, but I really like the visual indicator–maybe my C / Perl background is just too strong! 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:46:30+00:00Added an answer on June 5, 2026 at 2:46 am

    There’s not a convention; the visual indicator is prevalent in languages with no built-in notion of private functions. Since Clojure’s functions defined with defn- are not visible outside their namespace, there is no need to prefix functions with an uglifier 😉

    So do what you but, but you should probably want to just do as the rest of community does and just name them normally! It’ll make your life easier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to define a class friend function outside the namespace like this: namespace
I have this main function: #ifndef MAIN_CPP #define MAIN_CPP #include dsets.h using namespace std;
I realize that it's possible to define a static class method as private and
How can I declare and define a function so that it is only accessible
I need to define a read and a print function for a class that
Is it possible to define private variables in a PHP script so these variables
Normally, I've seen prototype functions declared outside the class definition, like this: function Container(param)
In C#, it is possible to define a readonly getter function by not defining
When reading Best way to define private methods for a class in Objective-C I
I am examining the private c++ function hooking code snippet from mobilesubstrate and see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.