clojure

How do I recompile and reload Java source code while `lein repl` is running?

こ雲淡風輕ζ 提交于 2019-12-20 09:37:44
问题 I have a Clojure project, and I'm using leiningen. I'm also using tools.namespace to reload Clojure code while running a REPL. If I want to include Java source in the project, can I recompile and reload it while the REPL is running? What is the most convenient/dynamic way of doing it? Can I do it so that it works well with tools.namespace? 回答1: I'm answering my own bounty here but I did do a bit of work getting this up: Use Vinyasa , and here is a blog post: Dynamic reloading of java code in

How does ClojureQL compare to clojure.contrib.sql?

主宰稳场 提交于 2019-12-20 09:35:04
问题 It looks like each one covers the basic cases like selecting certain columns and filtering by predicate pretty well, but I'm wondering how each compares for more advanced cases. Is it easier to express complex queries in one vis-à-vis the other? Is one library missing any functionality that the other covers? 回答1: ClojureQL and clojure.contrib.sql are two quite different libraries. The first aims to implement the primitives from relational algebra and compile those to SQL92. It also offer an

State of the Art for Clojure Documentation Tools [closed]

三世轮回 提交于 2019-12-20 09:28:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Over the last year or so I've seen various announcements on the Clojure discussion list and other places about tools for documenting Clojure code. These range from full-on literate programming systems like Marginalia, and the tool being used to create the book "Clojure in Small Pieces" (or even emacs org-mode), to

Attach a clojure / scala repl to a running JVM

左心房为你撑大大i 提交于 2019-12-20 09:23:53
问题 I have a java web application running under tomcat in a Sun java 6 JVM. Is there a way to attach a scala or clojure REPL to the running JVM ? Once the webapp is up and running, the context in which the calls are to be made is already setup in the running VM. Hence, this can be really helpful in invoking arbitrary java method calls for incremental, exploratory development and for debugging. 回答1: Copied over the answer from the other question as per your request: liverepl: Connect a Clojure

Efficient Clojure workflow?

大兔子大兔子 提交于 2019-12-20 09:21:37
问题 I am developing a pet project with Clojure, but wonder if I can speed up my workflow a bit. My current workflow (with Compojure) is: Start Swank with lein swank . Go to Emacs, connect with M-x slime-connect . Load all existing source files one by one. This also starts a Jetty server and an application. Write some code in REPL. When satisfied with experiments, write a full version of a construct I had in mind. Eval ( C-c C-c ) it. Switch REPL to namespace where this construct resides and test

How to Debug ClojureScript

点点圈 提交于 2019-12-20 09:17:05
问题 I apologize for this seemingly stupid question, but I've been playing with ClojureScript on and off for a few weeks now, and I can't figure out this one simple question: How do I debug ClojureScript? So here is the problem: I write my *.cjs files I run cljsc/build ... I load up my webpage. Something bad happens. I open up the firefox console. I get a line in the generated js, which I find incomprehensible, and I have no idea which line of the original cljs file it came from. My question: What

Mutable fields in Clojure deftype?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 09:16:11
问题 I'm trying out Clojure 1.2, specifically mutable fields which are supported in deftype according to the clojure.org documentation. But I can't get the set to work. What is the syntax for updating a field? Or isn't mutability implemented yet? (definterface IPoint (getX []) (setX [v])) (deftype Point [x] IPoint (getX [this] x) (setX [this v] (set! (.x this) v))) user=> (def p (Point. 10)) user=> (.getX p) 10 user=> (.setX p 20) ClassCastException: user.Point cannot be cast to compile__stub.user

What's the convention for using an asterisk at the end of a function name in Clojure and other Lisp dialects?

拜拜、爱过 提交于 2019-12-20 09:15:11
问题 Note that I'm not talking about ear muffs in symbol names, an issue that is discussed at Conventions, Style, and Usage for Clojure Constants? and How is the `*var-name*` naming-convention used in clojure?. I'm talking strictly about instances where there is some function named foo that then calls a function foo*. 回答1: In Clojure it basically means "foo* is like foo, but somehow different, and you probably want foo". In other words, it means that the author of that code couldn't come up with a

What is the difference between 1 and '1 in Lisp?

孤街浪徒 提交于 2019-12-20 09:14:24
问题 I had never really thought about whether a symbol could be a number in Lisp, so I played around with it today: > '1 1 > (+ '1 '1) 2 > (+ '1 1) 2 > (define a '1) > (+ a 1) 2 The above code is scheme, but it seems to be roughly the same in Common Lisp and Clojure as well. Is there any difference between 1 and quoted 1? 回答1: Well, they are in fact very different. '1 is however precisely the same as (quote 1) . (car ''x) evaluates to the symbol 'quote'. 1 is an S-expression, it's the external

What is the difference between 1 and '1 in Lisp?

戏子无情 提交于 2019-12-20 09:13:41
问题 I had never really thought about whether a symbol could be a number in Lisp, so I played around with it today: > '1 1 > (+ '1 '1) 2 > (+ '1 1) 2 > (define a '1) > (+ a 1) 2 The above code is scheme, but it seems to be roughly the same in Common Lisp and Clojure as well. Is there any difference between 1 and quoted 1? 回答1: Well, they are in fact very different. '1 is however precisely the same as (quote 1) . (car ''x) evaluates to the symbol 'quote'. 1 is an S-expression, it's the external