Fork me on GitHub
#cursive
<
2020-04-08
>
vehvis07:04:19

Any ideas as to why Cursive refuses to recognize arity>1 method implementations within deftype definitions in .cljc files, while the same code is fine inside .clj files? (It seems that this does not happen for everyone so maybe there's a setting somewhere)

vehvis07:04:50

(Using the latest mainline versions of both IDEA and Cursive)

vehvis07:04:35

Or more precisely, it's the method implementations inside a deftype that are not recognized as such, instead I get complaints about wrong arities

vehvis07:04:06

The exact same code works fine if it's in a .clj file

vehvis07:04:20

The problem actually occurs only when a method's arity is 2 or more. And just for cljc, not for clj. This screenshot is for cljc, and the bar method shows an "incorrect arity 2" error.

potetm12:04:10

seems to work for me

vehvis14:04:16

I've been able to get confirmation of this issue from a couple of colleagues using the latest Cursive, and one instance of "works for me" from one Cursive 1.8.x user. Which version do you have?

vehvis14:04:31

(And just to be sure, your testing was in a .cljc file?)

potetm14:04:47

1.9.1-2019.3

potetm14:04:50

and no, a clj file

potetm14:04:01

missed that bit, one sec

vehvis14:04:03

Rename to .cljc and see what happens

potetm14:04:23

Confirmed: cljc gets an error.

vehvis14:04:45

All right, thanks!

potetm14:04:37

funny, wrapping in a #?(:clj ..) appears to fix it

vehvis14:04:27

cljs parsing is suspect, then

vehvis14:04:57

Thanks for the help, I submitted an issue about this. Unfortunately there's almost a thousand open ones already...

favila15:04:52

is there a way to change the template used for “create namespace” files of various types? (I want to remove :refer :all on new test namespaces)

kenny15:04:36

You can do this in Editor &gt; File and Code Templates and change the Clojure Test Namespace template.

favila15:04:44

there they are! thanks3

✔️ 4
favila15:04:58

I can get rid of the double requires clauses too! amazing

John MacIsaac22:04:54

I am trying to setup REPL in Cursive, for learning Clojure. I’ve got the REPL setup for prompted inputs and outputs, which also receive the output of println commands within a function within a file, but I can’t figure out how to get output the function values of the file to the repl.

John MacIsaac22:04:57

I want to do what this guy is doing at 12:40 minutes in: https://www.youtube.com/watch?v=AmP6rW30wjE

John MacIsaac22:04:24

Any help would be greatly appreciated.

John MacIsaac22:04:21

The output from the println command is a side affect (akin a console log), not a function value. I want to see the return value of functions in repl.

tanzoniteblack23:04:44

he's executing that function in the repl via send form to repl command (or Alt+Shift+P if you're on linux)

tanzoniteblack23:04:21

which is basically (or perhaps literally): "Cursive, copy and paste the S-Exp I'm in to the repl window"

John MacIsaac23:04:32

This works for some but not all.

(ns brave.core)

'("hi")         ; ("hi")
(if true 1 2)   ; 1
(+ 1 2)         ; Syntax error compiling at (core.clj:12:1).
                ; Unable to resolve symbol: + in this context

(defn foo
  "I don't do a whole lot."
  [x]
  (println "Hello" x "!"))

(foo "katie")   ; Syntax error compiling at (core.clj:8:1).
                ; Unable to resolve symbol: foo in this context

John MacIsaac23:04:12

I assume for the + function, I need to import another dependency in the project.clj file:

(defproject brave "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[org.clojure/clojure "1.10.0"]]
  :repl-options {:init-ns brave.core})
but I dont know what to add.

rutledgepaulv23:04:42

+ is part of core. it sounds like you don't have clojure.core referred