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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:33:39+00:00 2026-05-27T14:33:39+00:00

Begin Edit: Mea Culpa! I apologize. I was running this in the cake repl

  • 0

Begin Edit:

Mea Culpa! I apologize.

I was running this in the cake repl at Clojure 1.2.1, and it honestly did not work. Now it does after exiting cake repl and a cake compile, and it also works at 1.3.0.

End Edit:

In the following: my dispatch function is being passed zero args, but I cannot figure out why. I’ve tested the dispatch function, and it does what it is supposed to. I would appreciate any suggestions.

(defrecord AcctInfo [acct-type int-val cur-bal])
(def acct-info (AcctInfo. \C 0.02 100.00))
ba1-app=> acct-info
ba1_app.AcctInfo{:acct-type \C, :int-val 0.02, :cur-bal 100.0}

(defn get-int-calc-tag [acct-type]
    (cond   (= acct-type \C) :checking
            (= acct-type \S) :savings
            (= acct-type \M) :moneym
            :else            :unknown))

(defmulti calc-int (fn [acct-info] (get-int-calc-tag (:acct-type acct-info))))

(defmethod calc-int :checking [acct-info] (* (:cur-bal acct-info) (:int-val acct-info)))

ba1-app=> (get-int-calc-tag (:acct-type acct-info))
:checking

ba1-app=> (calc-int acct-info)
java.lang.IllegalArgumentException: Wrong number of args (0) passed to: ba1-app$get-int-calc-tag
  • 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-27T14:33:40+00:00Added an answer on May 27, 2026 at 2:33 pm

    The problem could perhaps be related to the undocumented defonce-like behavior of defmulti.

    If you reload a namespace that contains a (defmulti foo ...) form then that defmulti won’t be updated. This often means that the dispatch function will not be updated but all method implementations (in the same namespace) will. (defmulti foo ...) does nothing if the foo var is already bound to a value.

    To fix this in a REPL, remove the multimethod var (ns-unmap 'the.ns 'the-multimethod) and then reload the namespace (require 'the.ns :reload).

    To prevent this problem you can define the dispatch function separately and pass its var to defmulti like this:

    (defn foo-dispatch [...]
      ...)
    
    (defmulti foo #'foo-dispatch)
    

    When the code looks like this it’s enough to reload the namespace if you make a change to foo-dispatch.

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

Sidebar

Related Questions

I apologize ahead of time if I am not asking this properly.. it is
So I have a fixed header in JQM 1.1 like this: ---- Begin Edit
Note: Do not edit the layout of this code! (See answer below for the
Begin Edit: Primarily I want my Clojure program to use a Java class. I've
I'm not even sure where to begin with this question... I want to be
To begin i read all resources from xml in my MergedDictionaries and now I
To begin with, I'm not even sure, if it is the right way to
I will begin this question by admitting I am very new to MVC. The
Current Code: - (void)textFieldDidBeginEditing:(UITextField *)textField { NSLog(@begin edit: %@, textField); } Related output: 2011-10-30
To be honest, I'm feeling pretty stupid right now. But this simply isn't working

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.