clojure

How to debug a console app from the REPL?

大兔子大兔子 提交于 2019-12-25 09:16:32
问题 It's really confortable to use emacs+cider for the daily development. All the stuff I've configured in my text editor makes it ideal for the task. The current project that I'm working on my spare time is a text editor . I've already implmented one in C++ and I used gdb to debug , from emacs. To run it, I entered set new-console on and run in the gdb buffer. This would pop a new console that would handle all the I/O . Now I'm trying to reimplement it in Clojure. By far, one of my biggest

Probabilistic Automata / Finite state machines in Clojure

拥有回忆 提交于 2019-12-25 07:52:04
问题 Does anyone know of any good resources for probabilistic finite state machines / automata in Clojure? I know of https://github.com/ztellman/automat and https://github.com/cdorrat/reduce-fsm (but I do not think they do what I want). See here: https://en.wikipedia.org/wiki/Probabilistic_automaton My problem is fairly simply (I think): I have multiple states, and transition between them is singular i.e. for now it is just a simple fixed distribution. I am still trying to gain clarity as to if

Mismatched argument count to recur in syntax quoted macro

不问归期 提交于 2019-12-25 07:49:09
问题 I'm creating a macro that will accept a sum in infix notation and return an equivalent list in prefix notation. Whilst the code probably isn't logically correct yet, I've run into the following error when calling the macro: CompilerException java.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 0 args, got: 5, compiling:(/tmp/form-init1201331851685991945.clj:1:1) Here's the macro's code: (defmacro infixer [o1 outlist i1 i2 i3] `(if (empty? ~i3) (concat ~i1 ~i2) (if

Writing a “cheating” Quine in Clojurescript

China☆狼群 提交于 2019-12-25 07:19:11
问题 Suppose we wanted to write a cheating quine in clojure, we could do: (ns cheating-quine) ... stuff here doesn't really matter ... (println (slurp *file*)) Now, this does not work in Lein Figwheel because the value of file ends up being something like /tmp/form-init########.clj, and contains bootstrapping code of some sort. Question: how can we get this "cheating" quine to work in clojurescript? Note: the goal is NOT to write a quine. The goal is to write a cljs program which has access to the

what are the Steps to setup nginx-clojure on windows 8

老子叫甜甜 提交于 2019-12-25 06:58:49
问题 Steps followed to setup nginx-clojure.0.4.0 in Windows-8 64 bit Downloaded the nginx-clojure.0.4.0.tar Unzipped the tar file and named it as nginx Modified the following properties in conf file nginx.conf : pid logs/nginx.pid; jvm_path "C:/Program Files (x86)/Java/jdk1.7.0_17/jre/bin/server/jvm.dll"; jvm_var my_other_jars 'D:/Learning/clojure-1.7.0/clojure-1.7.0.jar'; jvm_options "-Djava.class.path=jars/nginx-clojure-0.4.0.jar:#{my_other_jars}"; jvm_options "-Xms1024m"; jvm_options "-Xmx1024m

Port Error on Heroku / Clojure Deployment

无人久伴 提交于 2019-12-25 06:49:25
问题 This is a follow on question to my Heroku / Clojure problem here. As outlined in that thread, I was able to push my app to Heroku's master, and that deploys it. But when I try to go to my app's URL, I get the below error. It's a bizarre port error, but I didn't think I had control over those details when deploying a Clojure app on Heroku. I think my setup's pretty straightforward. Is there anything I can do to address this error? Procfile web: lein run -m http.handler http.handler ... (def

how to programatically check for reader macros

旧城冷巷雨未停 提交于 2019-12-25 04:14:16
问题 I have a vector which can contain arbitrary data. I want to check of any of the element is a reader macro, how do I do that ? (is-reader-macro? #<DateTime 2012>) ;=> true Thanks, Murtaza 回答1: Once a string is read you cannot tell by the resulting data what the exact reader construct was that created it. The data item you just read is not a reader macro, it's just data. In your specific example, what you've got is the printed representation of a jodatime DateTime object, which cannot be read -

clojure pr-str cutting off lists > 100 items

纵然是瞬间 提交于 2019-12-25 04:06:49
问题 I am trying to serialize some lists in clojure using pr-str, but any list with over 100 elements is getting cut off. Example: (pr-str (repeat 200 [2])) yields "([2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2] [2]

How to get Clojure Compojure app to run headless via compiled jar within Docker container?

淺唱寂寞╮ 提交于 2019-12-25 03:21:49
问题 Update : this question has changed since the original set of commenters left responses. Apologies for any confusion. This is my code repository https://github.com/Integralist/spurious-clojure-example you can use it as an example for what I'm working with. Note that the above repo relies on a library I've not yet published to Clojars (as I'm still testing it - hence this question opened). You can see the source code of the library here: https://github.com/Integralist/spurious-clojure-aws-sdk

find about about the type of function parameters

荒凉一梦 提交于 2019-12-25 02:45:01
问题 can i somehow find all functions/macros that take a specific type of parameter ? for example, what function accepts a Namespace object as parameter ? (this is because i can create a namespace and store it in a var, but i don't know where i could use that var; what function might i pass that var to ?) here is some code: user=> (def working-namespace (create-ns 'my-namespace)) #'user/working-namespace ;i created a namspace and want to use it later user=> (class working-namespace) clojure.lang