Fork me on GitHub
eccentric J03:10:38

Anyone familiar with Calva? How do you disconnect nrepl so you can do a clean restart + connect?


@jayzawrotny There's a #calva-dev channel that might be able to help.

❤️ 4

(I tried Calva but don't know enough to answer that question)

eccentric J05:10:34

Visiting the folks on vacation, got some personal time so decided to play with as many editors for Clojure as I can get my hands on. Tried Atom + ProtoREPL, and a bit of emacs. Now I’m playing with spacemacs, Cursive, and Calva.


hadn't heard about Calva! Looks neat. I'd never leave Emacs but how did you find the experience? Looks like something I can recommend to folks

eccentric J06:10:48

It seems to provide a pretty similar feature set to emacs’s offerings. Not seemingly as much variety in how things get sent to the REPL but still pretty solid. It was very easy to get started.


Happy to hear that. So it's robust for things like not getting random disconnections/errors in general? (I tend to assume those from newborn solutions)

eccentric J06:10:44

Not sure I can answer that. So far only really used it on new projects with not a lot of files or state. I’ve not run into any issues with that in so far.

👌 4
eccentric J06:10:18

One thing to note is that the source of calva is cljs so that might help leverage better compatibility than its VS Code contemporaries.

eccentric J05:10:43

Hmm for emacs\spacemacs is there a way to get the output of evaluation (C-c C-c) to persist keyboard navigation?


Assuming that C-C C-c sends its output to the echo area (I use different keyboard bindings), then no There are commands that send output to the repl instead. Recently discussed over #emacs

eccentric J05:10:18

Joined, thanks!


I really like cider-pprint-eval-last-sexp (, e P - in spacemacs). It will put the result in a cider-result buffer.

eccentric J06:10:39

Hmm seems to be C-c C-p


@jayzawrotny , you're trying them all! 😀 If you find some time I would like to hear about what you found out. The #editors channel might be the best suited for that.

eccentric J06:10:33

Sure, I could write some notes and share my experiences. Are you a contributor to one of them?

eccentric J06:10:46

Oh haha I see your name all over the calva source. Guess that question answered itself 🙂


Haha, yes. I am the one trying to keep Calva servicable.

Geoffrey Gaillard07:10:44

My team is searching for a way to map user stories to functional specifications, to test plans and to namespaces. E.G. "this namespace contributes to this feature, this feature contribute to this use-case. So if a test for this namespace is failing, a report would indicate which high-level feature is impacted". My first idea was to put tags (metadata?) on ns, deftest. Is there a tool or library providing something similar in the Clojure ecosystem?


spec (s/def ::form (s/keys :req [::password ::password-repeat])) Is a way to check if password-repeat is equal password using spec? AFAIK there is no way, but maybe something changed.

Jan K13:10:35

@kwladyka (s/def ::form (s/and #(= (::password %) (::password-repeat %)) (s/keys :req [::password ::password-repeat])))

🍻 4

@jkr.sw but from ::password-repeat perspective


This #(= (::password %) (::password-repeat %)) wouldn’t return me keyword in :cljs.spec.alpha/problems :via


I need to know reason of fail


so if not from ::password-repeat perspective, it can be additional condition, but I need to know what exactly fail during validation


(-> (s/explain-data spec value)
        (get-in [:cljs.spec.alpha/problems 0 :via]))


PS I know 0 is not right for map validation, but I want to show the intention


oh maybe i confuse myself…. It should be possible to return keyword


I messed with topics

Jan K13:10:19

it gives you the predicate that failed, you can give it a name


Another thing which I need is custom message. Like I would like to know why exactly something failed. Is it possible? For example “failed because it is 13:45”. This one is not possible I guess?


I am trying to not use functions directly during form validations, but it doesn’t look possible when I want to have custom messages for user depend on third party things.


I am looking a way to put it into specs, but it doesn’t look like a right tool for this job

Jan K13:10:56

I guess you'd have to map the problems structure to user-friendly error yourself


I will ask in different way: Is it possible to do for example ::user-exist and return reason with spec “User doesn’t exist. Did you mean user ‘foo’“?


I think it is not possible, but maybe I miss something


Then I have to make my own way to validate form inputs by functions instead of spec


Exactly mix spec and fn

Jan K13:10:56

I think you could build something like that on top of spec


I did, but I want to be sure I am not doing something which I don’t have to 🙂


How can I extend a class that has a package protected constructor using clj?


proxy generates a custom pkg


Trickier but possible with gen-class (which is AOT only, but can be “convinced” to work interactively):

;; Assuming this is the source of the class you want to extend:

package mypackage;
public class ProtectedTest {
  String protectedField = null;
  ProtectedTest(String s) {
    protectedField = s;
  public String getProtected() {
    return protectedField;

;; This is from a repl at the root of your project (and "src" is
;; in the class path):

(spit "src/mypackage/protectme.clj"
      "(ns mypackage.protectme)
          :name mypackage.ProtectMe
          :extends mypackage.ProtectedTest)")

;; trick gen-class into thinking  it's AOT time
(binding [*compile-path* "src"]
  (compile 'mypackage.protectme))

(import 'mypackage.ProtectMe)
(.getProtected (ProtectMe. "hey"))
;; "hey"


cool trick!


np! You can also just leave the protectme.clj as part of the sources, provided you remember to regenerate the classes if you ever throw away your target folder or change the gen-class directive.


During AOT (usually while uberjarring) that would be done automatically


(s/def ::form (s/keys :req [::email ::password] :opt [::password-repeat])) Can I read from this spec keywords ::email ::password ::password-repeat? The best with split by :req and :opt.


(apply hash-map (rest (s/describe (s/get-spec ::form))))
=> {:req [:sandbox.core/email :sandbox.core/password], :opt [:sandbox.core/password-repeat]}


@U3DAE8HMG 🍻 thank you

🤝 4

I've got a big json file on the clipboard, and I'd like to pass it to clj command line tool as a variable and start a repl so I can parse the json and work with it. Is this gonna be awkward?


I guess I can just write it to a file and slurp it


I'm trying out deps.edn on a multi-project repo. I'm wondering how the :paths key gets resolved in the context of a project with multiple sub-modules. So for example. If we had...

...what should I put in the root deps.edn to ensure that resources from both the sub-projects are on the classspath.


@cddr :local/root is always resolve relative to the cwd of the JVM. Even when it's in a dependency.


@cddr I should clarify that a bit actually. Does foo-web depend on foo-core?


In my case yes


@cddr then what you're after is not possible currently.


Unless you add a dependency on both I guess.


If it's always going to be just 2, then the maintenance isn't heavy. If there's a number of inter-dependencies, then it becomes tricky.


I can probably re-arrange the dependencies to suit


@cddr Edge has a similar problem, and solves it by having a folder named "main". Basically you need to have both modules and apps as siblings, rather than in a hierarchy.


Then you can add a :local/root on "../foo-web" which will transitively bring in "../foo-core".


Ah ok yeah that's totally fine


I want to migrate an app from nodejs to clojure/cljs, and I’m running into an issue where the existing user accounts are encrypted with a node lib called credential, using pbkdf2. Does anybody know a clojure equivalent I can use to check passwords without requiring everybody to reset?


I’ve tried buddy and weavejester/crypto-password, but can’t get it to work. Also looked at friend but it doesn’t look like it has the functions I need for this.


did you try with both pdkdf2 versions?

(def ^:no-doc algorithm-codes
  {"HMAC-SHA1"   "PBKDF2WithHmacSHA1"
   "HMAC-SHA256" "PBKDF2WithHmacSHA256"})


Hmm, I did with buddy but not with crypto-password, let me give that a try


darn sticky “s” key…


Is there a way to disable how Clojure prints generic objects?


if I have a (delay (range 100000)) it's trying to print the long seq of strings (once the delay is forced)


I want to stop that from happening