Fork me on GitHub
#cider
<
2024-07-31
>
conao306:07:20

(defn fibo-iter
  ([n] (fibo-iter 0 1 n))
  ([curr nxt n]
   (cond
     (zero? n) curr
     :else (recur nxt (+ curr nxt) (dec n)))))
;;=> #'user/fibo-iter

(schema.core/defn fibo-iter-with-schema
  ([n :- schema.core/Int] (fibo-iter 0 1 n))
  ([curr :- schema.core/Int
    nxt :- schema.core/Int
    n :- schema.core/Int]
   (cond
     (zero? n) curr
     :else (recur nxt (+ curr nxt) (dec n)))))
;;=> #'user/fibo-iter-with-schema

(fibo-iter 10)
;;=> 55

(fibo-iter-with-schema 10)
;;=> 55
I see cider debbugger doesn't work with schema.core/defn . Any ideas to make it work well? cider doc: https://docs.cider.mx/cider/debugging/debugger.html schema.core: https://github.com/plumatic/schema

jpmonettas12:07:42

it does work for me. What problem are you seeing? What I see is in your example fibo-iter-with-schema is calling fibo-iter instead of itself so the second signature never runs

conao312:07:42

sorry poor screen cast, this is what I see. (calling fibo-iter in fibo-iter-with-schema issue is fixed, sorry for confusing)

jpmonettas13:07:35

I was able to reproduce, can you try hitting n instead of c when the debugger first pops up

jpmonettas13:07:18

I'm not sure why it is even popping up there, looks like the macro expansion is calling the fn :thinking_face:

conao313:07:54

wow! Thanks! n instead of c makes debugger works well!

jpmonettas13:07:56

that is weird, looks like a bug to me, I guess we should create an issue