Fork me on GitHub
#babashka
<
2020-07-15
>
alex-eberts01:07:25

Hi all - I’ve been playing with strings in a babashka REPL and ran into a `java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn` error. Can anyone help me understand what I’m doing wrong here? Here’s the repl output:

alex-eberts01:07:43

roch=> (def raw-date "20200201")
roch=> (def year (subs raw-date 0 4))
roch=> (def month (subs raw-date 4 6))
roch=> (def day (subs raw-date 6 8))
roch=> (pr (str year "-" month "-" day))
roch=> java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn [at line 67, column 93]

borkdude06:07:00

@alex-eberts can't reproduce, which version are you using? if I can create a repro using version 0.1.3 that would be helpful

retrogradeorbit07:07:10

@alex-eberts have you redefined str to be a string?. Just eval str. What does that show? And what about evaling just pr?

alex-eberts14:07:47

@retrogradeorbit @borkdude Thanks for the hint! That turned out to be the problem… I must have redefined src previously in the repl session…. <facepalm>. Thanks!