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

  • SEARCH
  • Home
  • 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 7190101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:26:31+00:00 2026-05-28T19:26:31+00:00

What is the recommended method formatting large clauses inside a cond statement in Clojure?

  • 0

What is the recommended method formatting large clauses inside a cond statement in Clojure?

Ex:

(cond
 (> (large-function large-arg1
                    large-arg2
                    large-arg3)
    long-var-name))
 (->> (iterate #(* % 6) 1)
      (take 10)
      (apply +))
 (> (large-function large-arg4
                    large-arg5
                    large-arg6)
    long-var-name))
 (->> (iterate #(* % 6) 1)
      (take 10)
      (apply +))
 (> (large-function large-arg7
                    large-arg8
                    large-arg9)
    long-var-name))
 (->> (iterate #(* % 6) 1)
      (take 10)
      (apply +)))

If the result is on the same line as the condition, the result ends up way too indented, but if the result and the condition are different lines, it becomes too easy to lose track of conditions vs results. This seems like a situation where Common Lisp style cond would be useful, but adding the parentheses (probably brackets in Clojure’s case) doesn’t seem like the recommended course.

  • 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-05-28T19:26:32+00:00Added an answer on May 28, 2026 at 7:26 pm

    In many cases questions like this default to “format it the way emacs does”. Not that I inherently support this philosophy. It is ultimatly up to your sense of aesthetics

    in short conds i like:

    (cond
      (clause1) (action)
      (clause2) (action)
    

    for really long ones like yours I like to add some extra newlines as visual delimiters:

    (cond
       (clause)
       (action)
    
       (clause2)
       (action2)
    

    so i would format your code:

    (cond
     (> (large-function large-arg1
                        large-arg2
                        large-arg3)
        long-var-name)
     (->> (iterate #(* % 6) 1)
          (take 10)
          (apply +))
    
     (> (large-function large-arg4
                        large-arg5
                        large-arg6)
        long-var-name)
     (->> (iterate #(* % 6) 1)
          (take 10)
          (apply +))
    
     (> (large-function large-arg7
                        large-arg8
                        large-arg9)
        long-var-name)
     (->> (iterate #(* % 6) 1)
          (take 10)
          (apply +)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best or recommended method for bit shifting a large amount of
What is the recommended method for escaping variables before inserting them into the database
Using SqlParameters is a recommended method to prevent SQL Injection in your database queries.
When looking to get data from a web page whats the recommended method if
I'd like to know which method is recommended on Windows C programming: using malloc
what's the recommended method to encrypt flash files ? i'd like to make some
Is there a standard or recommended method of exporting the data from an Oracle
What would be the recommended method to create a table like display (columns, rows,
Whats recommended in an abstract class? Have a virtual method returning null, or have
I am trying to programatically add a startup item with LSSharedFileListInsertItemURL (the recommended method

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.