0

So I create a project with Lein: lein new app test

I open it in VSCode code test

I run Calva. I then test some simple functions in test.core. Works fine. Now I wanna have a new file with it's own namespace.

I create the file meat.clj inside: (ns test.meat) and try a simple function: (defn inc [a] (+ a 1))

I now run lein repl: lein repl then I navigate to the namespace (ns test.meat) => nil

Then try the function (inc 1) => Syntax error compiling at (C:\Users\felix\AppData\Local\Temp\form-init5552733050921187898.clj:1:1). Unable to resolve symbol: add in this context

Restarting the Calva server does not help, it can't find this new file.

I guess there maybe be some way to add a new file to Calvas build so it knows where to look? But I have no idea where to do this. Any ideas? The add function works in core but not in my custom namespace.

Tarmiac
  • 846
  • 1
  • 8
  • 14

1 Answers1

0

Couple possibilities:

If the namespace is test.meat, meat.clj needs to be in a directory named test.

Also you def'd a function called inc then you referred to it as add.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
gtoast
  • 16
  • 3
  • Yeah sorry fixed typo, thanks! Yeah, the meat.clj is in the same dir as core.clj and once again. The core.clj works fine. – Tarmiac Mar 31 '22 at 14:11
  • Check out this repl. I think this is what you're asking. https://replit.com/@gtoast/OptimalWelltodoCircles#main.clj One thing I did that you didn't mention was add a deps.edn to set up the current dir as a source path. – gtoast Mar 31 '22 at 14:38