Re: Newify java class dynamically

2015-03-09 Thread Tobias Kortkamp
On 03/09/2015 15:45, Juvenn Woo wrote: > Hi all, > > I am writing a function that'll take a java class name as an arg, > wherein I'll make instance of the class. Several approaches did I try: > > (let [klass Integer] (new klass 42)) ; this raises exception "unable to > resolve symbol: klass" > >

[ANN] from-scala 0.2.0: An experimental Scala interop library for Clojure

2015-03-09 Thread Tobias Kortkamp
Hi, I would like to announce from-scala, an experimental Scala interop library for Clojure. Its main feature is the $-macro, a version of Clojure's .-form. The $-macro uses Java reflection and a series of heuristics, so that you will be able to write code like ($ ($ scala.collection.immutable

Re: defmacro help

2015-03-13 Thread Tobias Kortkamp
> then the error is on the (schema.core/defn) call. But notice the fully > qualified 'create' - I want 'create' to be a literal in the namespace of > the caller, not the namespace the macro is defined in. > > Any ideas? Quote-unquote the symbol: ~'create Example: `(defn create []) => (clojure

Re: IllegalArgumentException when running core.async example

2014-07-08 Thread Tobias Kortkamp
In judge try changing (let [out async/chan] ...) to (let [out (async/chan)] ...) On Wednesday, July 9, 2014 5:57:53 AM UTC+2, endbegin wrote: > > Just tried it with Clojure 1.6.0. Still no luck! >> > -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: Does lein midje also run tests written using expectations?

2014-09-08 Thread Tobias Kortkamp
That `lein midje` runs your expectations is just a side effect of expectations' behavior to run its tests on JVM shutdown. Use `(expectations/disable-run-on-shutdown)` to disable that feature. > Just need to confirm that the behaviour is intentional and not just by chance. I guess it's a lit

Re: defrecord inside defmacro

2014-09-14 Thread Tobias Kortkamp
Hi, you need to syntax-quote the list you return from your macro. (defmacro some-record [some-name] `(defrecord ~some-name ['in 'out])) Note the backtick `. You then also have to explicitly quote your record field names (see 'in and 'out, try to remove the quotes to see why). Also s

Re: Clojure beginner: angst about "doing things right"

2014-09-22 Thread Tobias Kortkamp
Using map and sets: (defn days-number-maker [all-days day-string] (let [day-set (set day-string)] (map (fn [day] (if (day-set day) 1 0)) all-days))) (defn days-to-numbers "Change string like MTTH to (1 1 0 1 0 0 0)" [day-string] (let [d

Re: clojure/data.json parsing

2014-09-27 Thread Tobias Kortkamp
I hope I understood you correctly. You basically don't want to use println if you want to print data in such a way that it can be read in again. For that you need to use pr, prn or pr-str. Example: (println {:a "hi there"}) will print {:a hi there} (prn {:a "hi there"}) will print {:a "hi the

Re: [Very newbie] invocation of java code.

2014-10-01 Thread Tobias Kortkamp
java.util.TimerTask is an abstract class, which you cannot instantiate directly. You can use proxy to create a subclass: (proxy [java.util.TimerTask] [] (run [] ...)) Instead of (new java.lang.Boolean ...) use true or false directly. There is syntactic sugar for new, just append a dot to the

Re: midje test : Can I only run 1 test

2014-10-22 Thread Tobias Kortkamp
Yes, you can tag your facts, and then only run the facts with a specific tag. See https://github.com/marick/Midje/wiki/Lein-midje under the :filter section. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure

Re: Demoralising experience trying to install on Win 7

2014-10-25 Thread Tobias Kortkamp
I've changed the Leiningen installer, so that it uses wget instead of curl. That should fix the problems you were having. I've only only tested this on my Windows 7 VM, so please try it out. Download it here: https://github.com/t6/leiningen-win-installer/releases -- You received this message b

Re: How to handle fn args in a macro ?

2014-12-31 Thread Tobias Kortkamp
On 12/31/2014 18:56, rogergl wrote: > To make this work I had to replace the symbol 'topic in the body with > the gensym symbol. Is this the right way to do this ? Your macro is too complicated. You don't need to gensym a symbol in this case. Instead just quote a symbol before unquoting it (note

Re: How to find adjacent cells in a matrix with core.logic ?

2015-01-02 Thread Tobias Kortkamp
Move membero to the beginning (just after fresh, like in succo), it runs in < 100 ms on my machine then. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members ar

Re: Any Previous Work on Javadoc to Docstring Conversion?

2014-03-05 Thread Tobias Kortkamp
I have just uploaded some code I wrote earlier this year, where I originally set out to generate some useful docstrings for Java classes and methods. It currently uses javadoc on all Java source files on the classpath and creates a map with the extracted information. I never finished it, but thi