Fork me on GitHub
λustin f(n)08:03:47

For posterity: I had an old version of the adb (Android Debugging Bridge) that needed updating. Figwheel needs it to do its hot-reloading.

λustin f(n)08:03:26

Yay for old state from earlier experiments getting in the way.


Can I use map to iterate over a native js array?

Daniel Hines16:03:21

@rdanielo, you can, just keep in mind it returns a lazy seq as normal.

Daniel Hines16:03:38

If I'm trying to follow the 12 Factor App ( pattern with environ (, and I have credentials I'm using for development that can't be public, what is the typical usage? The best I could come up with is a bash script that exports the needed vars, but that doesn't seem far from the config file that 12 Factor is trying to avoid.

Michael Fiano16:03:30

Anyone using vscode for Clojure?


@d4hines the usual way for a 12-factor app to get credentials in production relies on something secure and private in the production system exporting those values into the process environment. That can be Heroku’s config, SSM Parameter Store in AWS, Hashicorp’s Vault, etc.


If you own all the pieces of your production platform then yes, at some point you will have something that does the same thing that bash file does, but you can do it in a secure way that doesn’t leak secrets out of the process environment for your service


(Like a Vault cluster)


To run in dev, you can use the lein or boot plugins for environ and supply the credentials at the command line, rather than keeping them all in a file somewhere.

Daniel Hines18:03:27

Can you give me some hints about how credentials from the commandline with lein works? I'm fairly new to lein. From environ's readme, it looked like I had to include the credentials in my project.clj, which would get checked into source control, which wouldn't work for me.


It looks like I might be wrong about supplying things directly on the command line with lein (I am mostly working in Boot projects these days, where you would say e.g. boot envrion -e admin-password=secret) but I think that the part you’re missing in the docs is this:


> The value of this key can be set in several different ways. The most common way during development is to use a local profiles.clj file in your project directory. This file contained a map that is merged with the standard project.clj file, but can be kept out of version control and reserved for local development options.


So you want to set your keys not in project.clj but in profiles.clj, which you can safety .gitignore

Daniel Hines17:04:26

Ooooh. I totally missed the profiles.clj part. Thanks a bunch!


@mfiano I do, and the experiecne is far from satisfiying

Michael Fiano17:03:54

@rdanielo Yeah, I just decided to try it and I agree that it is very lacking. There's not even a dedicated REPL that you can type into. I'm spoiled by Lisp use with Emacs for many years 🙂


I regret to use emacs. If I'm going to use a editor like that I will go for vim, but having to endensly configure it for every new language I want to try makes me waste so much time that I just gave up

Michael Fiano17:03:51

I will say that I also use vim regularly, and it just isn't there for Lisp, Clojure included. Emacs offers a much better experience.

Michael Fiano17:03:55

Spacemacs is a great Emacs distribution if you like Vim, and don't want to setup every language. It has sane defaults and plugins already configured for any language.


@mfiano for clojurescript, the best experience for me so far has been cursive, and I’ve tried everything (except vim)


i think atom + clojure + protorepl should work well


but protorepl is not really there for cljs

Michael Fiano17:03:33

I tried that too. Nothing is as complete or polished as Emacs for Lisp development in my opinion, and I've been doing Lisp for many years.


i used emacs for 10 years and i don’t miss it 🙂


but that’s beside the point. emacs is just a different ball of wax. I was just thinking that if you want a vscode like experience, cursive will deliver.

Michael Fiano17:03:24

No definitely not looking for something as limited as vscode, though I did try Cursive, and despite the bloat and RAM hunger, it is better. However, I wouldn't be able to live without magit anyway. That is hands down the best Git porcelain

Michael Fiano17:03:50

I also use Vim occasionally and open Emacs just for Magit support


hey everyone..I am trying to connect to a datomic database and when I run the command: (def conn (d/connect client {:db-name "hello"})) I get the following error:

CompilerException clojure.lang.ExceptionInfo: Connection refused #:cognitect.anomalies{:category :cognitect.anomalies/unavailable, :message "Connection refused"}, compiling:(form-init7933263063917191649.clj:1:11) 

does anyone know why this could be happening?


@mfiano spacemacs looks very appealing, but the fact that I have to learn a completely new set of keyboard shortcuts just for it, without any transfer to any other tool is not appealing to me

Michael Fiano18:03:16

You don't, if you are familiar with Vim as you said

Michael Fiano18:03:23

It uses Vim keybindings


Regarding cursive... I tend to avoid anything JVM baked. Too slow to start up and too resource hungry

replied to a thread:It uses Vim keybindings

I'll try it out then

Daniel Hines18:03:53

Yeah, I've started using Spacemacs in the last month or so. I was completely new to Vim and Emacs, so there was a steep curve, but it's paying off. It's still not as nice as my experience with VS Code for JavaScript, but it's getting there, and I'm at least confident I'll never outgrow the tool.

Daniel Hines18:03:07

The Clojure layer provides a very easy hotkey for opening up online docs on symbols under point, which has been incredible for learning the language.

Daniel Hines18:03:27

Can you give me some hints about how credentials from the commandline with lein works? I'm fairly new to lein. From environ's readme, it looked like I had to include the credentials in my project.clj, which would get checked into source control, which wouldn't work for me.


@d4hines What O/S are you running on? On OS X and Linux, you can just say

VARNAME=value lein some args

Daniel Hines19:03:42

I'm on Ubuntu, using Emacs/Cider.

Daniel Hines19:03:03

I'd have to translate that to cider-jack-in somehow though.


OK, so you could set them in your shell before you start emacs.

Daniel Hines19:03:35

Right, and then just start emacs from that shell. Thanks!


Hi guys! How can I clear atoms before run another test file?


For example: I have a compojure-api with a handler.clj file and a core.clj file and when I core_test.clj file, I add some data in a atom that I have, but when I run the handler_test.clj I want a clear atom to start again


(idk if i'm being clear here, but I just want a fresh start for each test file that i run)


you can set the value of an atom to whatever you need with reset!, ie (reset! your-atom nil)


@d4hines it looks like emacs can alter its environment while running. check out setenv so you don't have to alter the startup if you don't want to

Daniel Hines20:03:30

Yeah, I saw that! I actually put together a elisp script to do just that. I just wanted to confirm that I wasn't missing a super easy way to do it, as I try to avoid writing elisp if possible 😝


I have an intermediate level proficiency at vanilla JS but I've never gotten into React. Is it recommended to get familiar with React before diving into Om?


simply reading through the React docs is enough, you don't need to have used it before (i haven't)


though i would recommend Fulcro instead of Om (it's Om-inspired)


How do I change Clojure version in Light Table, it's showing 1.5.1

Michael Fiano21:03:46

Can someone help me figure out how to get rid of these 2 warnings when I run lein repl or boot repl on Clojure 1.9.0? They don't appear on 1.8.0, and they also don't appear with 1.9.0 on my other PC so I'm stumped: Edit: they also happen with latest 1.10 alpha release

WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace:, being replaced by: #'
WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace:, being replaced by: #'
nREPL server started on port 36715 on host - 
REPL-y 0.3.7, nREPL 0.2.13
Clojure 1.9.0
OpenJDK 64-Bit Server VM 1.8.0_162-b12
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e


@mfiano perhaps try putting [org.clojure/tools.analyzer.jvm "0.7.2"] (the latest) into your deps? might've been fixed

Michael Fiano21:03:54

Removing [refactor-nrepl "2.3.1"] from my global user profile fixed it, but I have no clue what that prevents me from doing now.


basically it looks like that version of refactor-nrepl pulls in a version of mranderson that pulls in a version of tools.analyzer.jvm that defines a boolean? function without excluding it first


if you add it back and run lein deps :tree or boot show they may tell you what exclusion you need to add

Michael Fiano21:03:40

Seems to be the latest version...huh. I wonder why it doesn't occur on my other PC using a version of "LATEST"

Michael Fiano21:03:57

Aye. I just switched to 2.4.0-SNAPSHOT and don't have warnings, so problem solved I guess. Thanks 🙂


ah, sweet. no problem!


hello, can anybody help me with an issue with re-natal ?


no issue with starting the app on the android simulator and modifying it. It is the repl that gets "stuck" after Prompt will show when Figwheel connects to your application


solved my problem. I had to run re-natal use-android-device avd.


hi, i’m playing with the spec guide for specing the function. I use the exact code in the guide, but i don’t think the spec is doing its job. For example, i can still call function (ranged-rand 10 3), i expect the spec would disallow this since start 10 is bigger than 3, anyone know am i doing something wrong here?


Can you share exactly what you tried?


(defn ranged-rand
  "Returns random int in range start <= rand < end"
  [start end]
  (+ start (long (rand (- end start)))))

(s/fdef ranged-rand
        :args (s/and (s/cat :start int? :end int?)
                     #(< (:start %) (:end %)))
        :ret int?
        :fn (s/and #(>= (:ret %) (-> % :args :start))
                   #(< (:ret %) (-> % :args :end))))

(ranged-rand 100 10)
exact same as the guide


i would expect the ranged-rand now throw something with wrong argument, wouldn’t it?


You need to call instrument in order to enable spec checking on functions.


user=> (require '[clojure.spec.test.alpha :as st])
user=> (st/instrument `ranged-rand)
user=> (ranged-rand 10 3)
ExceptionInfo Call to #'user/ranged-rand did not conform to spec:
val: {:start 10, :end 3} fails at: [:args] predicate: (< (:start %) (:end %))
  clojure.core/ex-info (core.clj:4739)


oh, thanks!


Instrumentation is likely to be useful at both development time and during testing to discover errors in calling code. It is not recommended to use instrumentation in production due to the overhead involved with checking args specs. I’m not sure i quiet understand the full implication of this. Does that mean the whole idea of writing a function spec is only for development and test purpose? It’s not recommend to write function spec(fdef) for validation purpose?


@luwh364 Instrumentation causes a runtime overhead so you probably won't want it enabled in production.


Mostly I write specs for data and I do use that in production -- with s/conform mostly -- but I only use instrumentation during development/testing.


Also, bear in mind that instrumentation checks that calls into your function are correct -- it doesn't check the behavior of the function (what it returns). That sort of checking is intended to be done separately as part of testing, since behavioral testing is done with generative testing.