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 8283495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:45:12+00:00 2026-06-08T10:45:12+00:00

As a side project I’m creating a Clojure DSL for image synthesis ( clisk

  • 0

As a side project I’m creating a Clojure DSL for image synthesis (clisk).

I’m a little unsure on the best approach to function naming where I have functions in the DSL that are analogous to functions in Clojure core, for example the + function or something similar is needed in my DSL to additively compose images / perform vector maths operations.

As far as I can see it there are a few options:

  1. Use the same name (+) in my own namespace. Looks nice in DSL code but will override the clojure.core version, which may cause issues. People could get confused.
  2. Use the same name but require it to be qualified (my-ns/+). Avoids conflicts, but prevents people from useing the namespace for convenience and looks a bit ugly.
  3. Use a different short name e.g. (v+). Can be used easily and avoid clashes, but the name is a bit ugly and might prove hard to remember.
  4. Use a different long name e.g. (vector-add). Verbose but descriptive, no clashes.
  5. Exclude clojure.core/+ and redefine with a multimethod + (as georgek suggests).

Example code might look something like:

 (show  (v+ [0.9 0.6 0.3] 
             (dot [0.2 0.2 0] 
                  (vgradient (vseamless 1.0 plasma) ))))

What is the best/most idiomatic approach?

  • 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-08T10:45:14+00:00Added an answer on June 8, 2026 at 10:45 am

    first, the repeated appearance of operators in an infix expression requires a nice syntax, but for a lisp, with prefix syntax, i don’t think this is as important. so it’s not such a crime to have the user type a few more characters for an explicit namespace. and clojure has very good support for namespaces and aliasing. so it’s very easy for a user to select their own short prefix: (x/+ ...) for example.

    second, looking at the reader docs there are not many non-alphanumeric symbols to play with, so something like :+ is out. so there’s no “cute” solution – if you choose a prefix it’s going to have to be a letter. that means something like x+ – better to let the user choose an alias, at the price of one more character, and have x/+.

    so i would say: ignore core, but expect the user to (:require .... :as ...). if they love your package so much they want it to be default then they can (:use ...) and handle core explicitly. but you choosing a prefix to operators seems like a poor compromise.

    (and i don’t think i have seen any library that does use single letter prefixes).

    one other possibility is to provide the above and also a separate package with long names instead of operators (which are simply def’ed to match the values in the original package). then if people do want to (:use ...) but want to avoid clashes, they can use that (but really what’s the advantage of (vector-add ...) over (vector/+ ...)?)

    and finally i would check how + is implemented, since if it already involves some kind of dispatch on types then georgek’s comment makes a lot of sense.

    (by “operator” above i just mean single-character, non-alphanumeric symbol)

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

Sidebar

Related Questions

I am creating a VB.NET application for a Calculus class as a little side-project.
I have a little side project where I allow radius search. You input a
I am creating a network chat client in C# as a side project. In
I've been working on a web app in Clojure as a side project, and
I am working on a little side project (program for Android platform)and I don't
I'm developing a little side-project to display multiple wallpapers on multiple screens under GNOME
I've started a little side project to try to learn a few new concepts
As a little side project, I am starting to build a new website for
I am starting a little side project which consists of building a small-medium sized,
As a little side project I'd thought it would cool to make a text

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.