Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong arity error messages for certain functions (apply, reduce) #653

Closed
Cnly opened this issue Dec 11, 2021 · 1 comment
Closed

Wrong arity error messages for certain functions (apply, reduce) #653

Cnly opened this issue Dec 11, 2021 · 1 comment

Comments

@Cnly
Copy link

Cnly commented Dec 11, 2021

version

This is with babashka 0.7.0 so should be https://github.com/babashka/sci/tree/573ee0e2f2ecdfc30f9f4b0d306626cacd6d3f06.

platform

Mac, binary

problem

Reducing functions lacking implementations for arities other than 2 can cause bb to give the wrong error message when used with clojure.core/reduce.

repro

(defn rf [a b] (conj a b))
(reduce rf [])

Result: clojure.lang.ArityException: Wrong number of args (0) passed to: clojure.core/reduce [at <repl>:5:3]

expected behavior

Correct error message given by clojure: Wrong number of args (0) passed to: user/rf

@rwstauner
Copy link

this is also the case for apply:

$ clj
user=> (defn foo [a b] (prn a b))
#'user/foo
user=> (apply foo [1 2 3])
Execution error (ArityException) at user/eval7940 (REPL:1).
Wrong number of args (3) passed to: user/foo
$ bb
*user=> (defn foo [a b] (prn a b))
#'user/foo
*user=> (apply foo [1 2 3] )
clojure.lang.ArityException: Wrong number of args (3) passed to: clojure.core/apply [at <repl>:2:1]

@Cnly Cnly changed the title Wrong error message when using reduce with certain reducing functions Wrong arity error messages for certain functions (apply, reduce) Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants