clojure

clojure.java.sh: No such file or directory

非 Y 不嫁゛ 提交于 2021-02-17 02:14:29
问题 I've written a program to assemble .dot files, and want to use Clojure's sh to give a compile command. Specifically, I use the following function to do it: (defn compile-graphviz "Dumps graphviz-string to a file, then compiles it using dot." [graphviz-string] (do (spit "./tree.dot" graphviz-string) (sh "dot -Tpng \"/.tree.dot\" -o\"/.tree.png\""))) However, when I run this, the second part fails, giving the following error message at the REPL: IOException error=2, No such file or directory

我是一名技术总监,被技术选型给埋坑里了

半腔热情 提交于 2021-02-11 20:31:42
Dan McKinley 无明 阅读数:20663 2019 年 7 月 22 日 本文主人公从事软件开发近 20 年,既在大公司待过,也在小公司待过。在他的职业生涯中,发现了很多跟技术选型相关的各种问题:应该选新潮的技术还是无聊的技术?应该搭建极客范的技术栈还是使用基础的工具?应该用开发者喜欢的还是维护起来省事的?他对此作了深入的剖析,希望能帮到你。(多图流量预警!) 我叫 Dan McKinley,坑里的那个人就是我。 我现在在一家叫作 Mailchimp 的公司上班。更早之前是在 Etsy,因为在 Etsy 待的时间比较长,所以后面会更多地提到我在这家公司的经历。其实在离开 Etsy 之后,我也在其他几家公司干过。 我既在大公司待过,也在小公司待过,还创办过自己的公司。在经历了这些公司之后,我注意到了一些现象。 大公司有自己的做事方式,他们提供了“沙盒”一样的环境,在这样的环境里,会有人满足你的需求,帮你答疑解惑,让你感觉受到了“百般宠爱”。 但我也经历过几个过渡时期,在这些过渡时期,需要自己解决一些棘手的问题。 首先, 如何选择合适的技术? 另一个我比较关心的问题是: 如何让开发人员开心地使用这些技术? 因为我自己也是开发者,所以这一点对于我来说比较重要。如果有可能,我会尽量让自己过得开心些。 如果你问开发人员什么东西会让他们开心,他们通常会说:“如果可以使用

Using Clojure in Repl without opening en closing parentheses

为君一笑 提交于 2021-02-11 15:48:41
问题 I am curious if it is possible to write a function in clojure that can be called from the repl without opening and closing parentheses. I use for example always the following function: (defn ll [] (load-file "D:\\work.clj")) I have to call this with (ll) but it would come in handy if only ll was needed. [My idea comes from autocad/autolisp. In there I can define a function like (defun c:somecommand () . . ) From this point on I can use somecommand on the commandline (because of 'c:' before

How to automatically enable paredit mode on all clojure, closurescript and elisp buffers automatically?

江枫思渺然 提交于 2021-02-11 14:14:02
问题 I want to enable paredit-mode on all clojure, cljs and elisp buffers by default, which is probably going to happen through the .spacemacs file. This is what I have so far in the user-config function of my .spacemacs: ;; paredit autoload (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t) (add-hook 'clojure-mode #'enable-paredit-mode) (add-hook 'clojurescript-mode #'enable-paredit-mode) But it doesn't really work. What am I doing wrong? 回答1: In the

Idiomatic way to wrap object into collection (if it's not a collection already) in Clojure?

本秂侑毒 提交于 2021-02-10 18:36:52
问题 I have (for instance) a mix of data structures such as {:name "Peter" :children "Mark"} and {:name "Mark" :children ["Julia" "John"] i.e. :children value is either a single string or a collection of strings. Other functions in my code expect that the value of :children is always a collection of strings, so I need to adapt the data for them. Of course I can use something like: (defn data-adapter [m] (let [children (:children m)] (assoc m :children (if (coll? children) children [children]))))

Idiomatic way to wrap object into collection (if it's not a collection already) in Clojure?

让人想犯罪 __ 提交于 2021-02-10 18:28:12
问题 I have (for instance) a mix of data structures such as {:name "Peter" :children "Mark"} and {:name "Mark" :children ["Julia" "John"] i.e. :children value is either a single string or a collection of strings. Other functions in my code expect that the value of :children is always a collection of strings, so I need to adapt the data for them. Of course I can use something like: (defn data-adapter [m] (let [children (:children m)] (assoc m :children (if (coll? children) children [children]))))

error in process sentinel: Could not start nREPL server: java.lang.NumberFormatException: Invalid number

十年热恋 提交于 2021-02-10 18:18:00
问题 I've looked at all of the similar questions on stack overflow. This one is different enough to warrant a separate question. Basically, I can't start a repl server because I get the error below. It's been pointed out that this is typically a dependency issue, but I'm updated, to my knowledge. What am I getting wrong here? Here's the full error: error in process sentinel: Could not start nREPL server: java.lang.NumberFormatException: Invalid number: 0.8.3 at clojure.lang.LispReader.readNumber

Why are there clj and cljs folders in my lein re-frame template?

倖福魔咒の 提交于 2021-02-10 12:15:50
问题 Why are there clj and cljs folders in my lein re-frame template as below? And why do they both include files called .core that appear to use the same namespaces? I've been told this is the place to start when learning re-frame, but I cannot find any explanations of why the templates are setup the way they are or created including the content they include. There is no explanation for any of the boilerplate or code that comes with any lein template which make them very hard to use for beginners

Why are there clj and cljs folders in my lein re-frame template?

一笑奈何 提交于 2021-02-10 12:14:21
问题 Why are there clj and cljs folders in my lein re-frame template as below? And why do they both include files called .core that appear to use the same namespaces? I've been told this is the place to start when learning re-frame, but I cannot find any explanations of why the templates are setup the way they are or created including the content they include. There is no explanation for any of the boilerplate or code that comes with any lein template which make them very hard to use for beginners

Why are there clj and cljs folders in my lein re-frame template?

瘦欲@ 提交于 2021-02-10 12:13:26
问题 Why are there clj and cljs folders in my lein re-frame template as below? And why do they both include files called .core that appear to use the same namespaces? I've been told this is the place to start when learning re-frame, but I cannot find any explanations of why the templates are setup the way they are or created including the content they include. There is no explanation for any of the boilerplate or code that comes with any lein template which make them very hard to use for beginners