Wrong argument number to recur function

Epitouille

I'm a beginner with functional programming and I try to pretty print a maze.
Here is my function

(defn pprint-maze
  [arr row col]
  (loop [coll arr idx 0]
    (match [idx]
      [(_ :guard #(= (mod idx col) 0))] (println "") ; write a \n
      :else (print "-"))                       ; write a wall
    (when (next coll)
      (recur (next coll) (inc idx)))))

My function takes the collection and the size of the maze and for now, just print a dash and a \n at the end of the row. The problem I've it's : Exception in thread "main" clojure.lang.ArityException: Wrong number of args (1) passed to: core/pprint-maze/fn--4873/fn--4874

I think the function pointed out is my loop function, and the problem is related to match (because when I comment the match block, everything work). I think that match try to call the loop function with nil as argument (the return of the println function).

How to solve that ?

amalloy

The function passed to :guard should take exactly one argument, the value being guarded. Your function takes zero arguments.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Wrong number of args passed to keyword when using recur

From Dev

Wrong number of args passed to keyword when using recur

From Dev

why this code is wrong ? How does 'recur' work?

From Dev

Redis publish - Wrong number of argument for 'set'

From Dev

Wrong type argument: number-or-marker-p

From Dev

Ruby - Wrong number of argument (1/2)

From Dev

Function name as argument but with different number of argument

From Dev

NTILE function, wrong number of records

From Dev

Value of clicked element function argument is wrong

From Dev

Python: wrong assignment of default argument in a function

From Dev

rails collection_select wrong number of argument error

From Dev

Rails 3 to 4 wrong number of arguments error for empty hash argument

From Dev

"Wrong number or types of argument in call to '>'" when comparing dates in PLSQL

From Dev

PHP - pass line number automatically as function argument

From Dev

Why is it necessary pass the number of columns as a function argument?

From Dev

Don't call function if argument is not a number

From Dev

What's wrong with this python prime number function?

From Dev

How to check for wrong number of parameters passed to a function

From Dev

jQuery: time function outputs wrong number of days

From Dev

What's wrong with this string_to_number function?

From Dev

Lisp function getting wrong number of arguments

From Dev

factorial of number using argument recursion(as in function call within argument list)

From Dev

Mock's autospec injects a wrong argument into a called function

From Dev

Throw an error/warning when supplying wrong argument type to C function

From Dev

Throw an error/warning when supplying wrong argument type to C function

From Dev

Mock's autospec injects a wrong argument into a called function

From Dev

UWP Webview InvokeScriptAsync passes wrong argument to JS function

From Dev

C# Unity Wrong argument of the function in onClick event

From Dev

Clojure - using recur vs plain recursive function call

Related Related

  1. 1

    Wrong number of args passed to keyword when using recur

  2. 2

    Wrong number of args passed to keyword when using recur

  3. 3

    why this code is wrong ? How does 'recur' work?

  4. 4

    Redis publish - Wrong number of argument for 'set'

  5. 5

    Wrong type argument: number-or-marker-p

  6. 6

    Ruby - Wrong number of argument (1/2)

  7. 7

    Function name as argument but with different number of argument

  8. 8

    NTILE function, wrong number of records

  9. 9

    Value of clicked element function argument is wrong

  10. 10

    Python: wrong assignment of default argument in a function

  11. 11

    rails collection_select wrong number of argument error

  12. 12

    Rails 3 to 4 wrong number of arguments error for empty hash argument

  13. 13

    "Wrong number or types of argument in call to '>'" when comparing dates in PLSQL

  14. 14

    PHP - pass line number automatically as function argument

  15. 15

    Why is it necessary pass the number of columns as a function argument?

  16. 16

    Don't call function if argument is not a number

  17. 17

    What's wrong with this python prime number function?

  18. 18

    How to check for wrong number of parameters passed to a function

  19. 19

    jQuery: time function outputs wrong number of days

  20. 20

    What's wrong with this string_to_number function?

  21. 21

    Lisp function getting wrong number of arguments

  22. 22

    factorial of number using argument recursion(as in function call within argument list)

  23. 23

    Mock's autospec injects a wrong argument into a called function

  24. 24

    Throw an error/warning when supplying wrong argument type to C function

  25. 25

    Throw an error/warning when supplying wrong argument type to C function

  26. 26

    Mock's autospec injects a wrong argument into a called function

  27. 27

    UWP Webview InvokeScriptAsync passes wrong argument to JS function

  28. 28

    C# Unity Wrong argument of the function in onClick event

  29. 29

    Clojure - using recur vs plain recursive function call

HotTag

Archive