clojure

Remote REPL no output, how to dublicate output in PrintWriter?(Clojure)

久未见 提交于 2021-01-29 09:31:09
问题 Cannot connect remote REPL properly Here are the steps I do: Start local repl instance: lein repl Connect to local by remote repl instance(I do it through Intellij IDEA) After this, every output in code goes only in local repl, in remote one there are nothing What I need: to see all outputs in both repl instances I have found partial solution, this code rebinds output of one repl to another. Just run it in remote one, and all output will go to it (defn rebind-output [] (prn "Rebinding output.

How to set a dynamic var before aot compile

本小妞迷上赌 提交于 2021-01-29 08:50:26
问题 I want to have a *flag* variable in a given namespace that is set to true only when :aot compiling. Is there a way to do that? 回答1: Your issue is kind of complicated because the definition of Clojure's own dynamic nature, so there's no rough equivalent of C's #ifdef or some other mechanism that happens at compile time, but here's a workaround: I created a Leiningen project with lein new app flagdemo . This trick detects when AOT is performed, as @Biped Phill mentioned above, using the dynamic

Call functions read from EDN files

你说的曾经没有我的故事 提交于 2021-01-28 07:02:22
问题 I have an EDN configuration file in which the entries refer to existing functions, e.g.: :attribute-modules {:content {:class lohan.extractors.content/process} :schema {:class lohan.extractors.schema/process} :label {:class lohan.extractors.label/process} :user {:class lohan.extractors.user/process} :env {:class lohan.extractors.env/process}} Using clojure.edn/read-edn these entries are read as Symbols, but I want to be able to call them at runtime. The purpose of this is to provide a way for

Clojure on emacs fails when running cider-jack-in command

回眸只為那壹抹淺笑 提交于 2021-01-28 05:33:26
问题 I had been using Clojure on emacs on my Bunsenlabs linux which was similar to Debian. Ones it stopped working. cider-jack-in command caused error. Could anybody help me to fix it? The versions and error message are these: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.20) of 2017-09-12, modified by Debian cider 20180207.239 clojure-mode 20180202.922 Leiningen 2.8.1 on Java 1.8.0_161 Java HotSpot(TM) 64-Bit Server VM Clojure 1.8.0 Loading 00debian-vars...done Loading /etc/emacs/site

“The clojure executable isn’t on your ‘exec-path’” even though lein is on my exec-path (macOS)

末鹿安然 提交于 2021-01-27 12:10:16
问题 I have the following exec-path (according to describe-variable ): ("/usr/local/bin/" "/usr/bin/" "/bin/" "/usr/sbin/" "/sbin/" "/usr/local/Cellar/emacs-plus/25.3/libexec/emacs/25.3/x86_64-apple-darwin16.7.0/") This is the lein executable path: /usr/local/bin/lein This is what happens when I run cider-jack-in : The clojure executable isn’t on your ‘exec-path’ What gives? Edit: ( cider-lein-command is lein ) 回答1: (from the comment) Looks like cider is looking for the clojure command, not the

“The clojure executable isn’t on your ‘exec-path’” even though lein is on my exec-path (macOS)

情到浓时终转凉″ 提交于 2021-01-27 12:04:25
问题 I have the following exec-path (according to describe-variable ): ("/usr/local/bin/" "/usr/bin/" "/bin/" "/usr/sbin/" "/sbin/" "/usr/local/Cellar/emacs-plus/25.3/libexec/emacs/25.3/x86_64-apple-darwin16.7.0/") This is the lein executable path: /usr/local/bin/lein This is what happens when I run cider-jack-in : The clojure executable isn’t on your ‘exec-path’ What gives? Edit: ( cider-lein-command is lein ) 回答1: (from the comment) Looks like cider is looking for the clojure command, not the

Clojure warning: “resultset-seq already exists in clojure.core”

对着背影说爱祢 提交于 2021-01-27 08:10:57
问题 I'm new to Clojure and building a web app using the Noir framework (very similar to Compojure, in fact I think it's Compojure with a different request handler layer). I'm getting a warning when I import the JDBC library: WARNING: resultset-seq already refers to: #'clojure.core/resultset-seq in namespace: webapp.models.database, being replaced by: #'clojure.java.jdbc/resultset-seq Do I have to live with this warning or is there a way around it? I'm importing the JDBC library using: (use

Clojure warning: “resultset-seq already exists in clojure.core”

两盒软妹~` 提交于 2021-01-27 08:10:24
问题 I'm new to Clojure and building a web app using the Noir framework (very similar to Compojure, in fact I think it's Compojure with a different request handler layer). I'm getting a warning when I import the JDBC library: WARNING: resultset-seq already refers to: #'clojure.core/resultset-seq in namespace: webapp.models.database, being replaced by: #'clojure.java.jdbc/resultset-seq Do I have to live with this warning or is there a way around it? I'm importing the JDBC library using: (use

Clojure Ring wrap-reload is not working

若如初见. 提交于 2021-01-27 07:51:48
问题 This is my core.clj file (ns lein-app.core (:require [compojure.core :refer :all] [compojure.route :as route] [ring.middleware.reload :refer [wrap-reload]])) (use 'ring.adapter.jetty) (defroutes app (GET "/" [] "<h1>Hello world</h1>") (route/not-found "<h1>Not found</h1>")) (def reloadable-app (wrap-reload app)) (defn -main [] (run-jetty reloadable-app {:port 3000})) And this is my project.clj (defproject lein-app "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example

Clojure Ring wrap-reload is not working

守給你的承諾、 提交于 2021-01-27 07:43:22
问题 This is my core.clj file (ns lein-app.core (:require [compojure.core :refer :all] [compojure.route :as route] [ring.middleware.reload :refer [wrap-reload]])) (use 'ring.adapter.jetty) (defroutes app (GET "/" [] "<h1>Hello world</h1>") (route/not-found "<h1>Not found</h1>")) (def reloadable-app (wrap-reload app)) (defn -main [] (run-jetty reloadable-app {:port 3000})) And this is my project.clj (defproject lein-app "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example