Is there a sortBy function in Sparkling ?

2016-07-10 Thread rogergl
I can do something like this val sortedCounts = counts.sortBy(kvPair => kvPair._2, false) in Scala. So far I only found the *sort-by-key *function in Sparkling, which doesn't exactly do what I need... Regards Roger -- You received this message because you are subscribed to the Google

ClojureCLR and nrepl ?

2015-05-06 Thread rogergl
Does ClojureCLR provide an nrepl implementation that would allow vim.fireplace to connect to his session ? Regards Roger -- 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

is there a shorter way to do this in core.logic ?

2015-01-04 Thread rogergl
The following snippet works (fresh [?row ?col] (fd/+ row 1 ?row) (fd/+ col 1 ?col) (membero {:row ?row :col ?col} data)))] ; check existence of {:row (?row + 1) :col (?col + 1)} But I'm not sure if this isn't to verbose.

How to access nested structures with core.logic ?

2015-01-02 Thread rogergl
I have the following simple core.logic snippet: (def my-data [ {:name 'peter :some-data { :some-value: 42 } :sales 1200 :age 32} {:name 'paul :sales 200 :age 42} {:name 'mary

Re: How to handle fn args in a macro ?

2015-01-02 Thread rogergl
If it were me I'd avoid making 'topic a magic symbol and let the user choose a symbol to bind. It'd look something like Yes, that is true and I already changed my macro. I just wanted to take little steps towards the final goal. Thanks Roger -- You received this message because you are

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

2015-01-02 Thread rogergl
I would like to find the entries with 4 adjacent cells (horizontally or vertically) ? Is this the right way to do this ? I don't think so, since my solution seems to be very slow. Evaluating in LightTable takes about 10 seconds. (def matrix [ {:row 1 :col 1}

Re: How to access nested structures with core.logic ?

2015-01-02 Thread rogergl
I didn't know that featurec supported this. BTW: If anyone is interested. The following works: (def my-data [ {:name 'peter :sales 1200 :nested { :value 123} :age 32} {:name 'paul :sales 200

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

2015-01-02 Thread rogergl
Also in this case I don't really see the value over writing the search directly - but your goals are not clear to me It's just an exercise to get a feel for what core.logic can be used for. Regards Roger -- You received this message because you are subscribed to the Google Groups

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

2015-01-02 Thread rogergl
Ok, the execution time is about 3sec in a standalone repl. Much faster but imho still way to slow. Regards Roger -- 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

How to handle fn args in a macro ?

2014-12-31 Thread rogergl
I just started to play with macros in Clojure. The following is a simple example that expands to: (on-message topic-test (clojure.core/fn [topic13730] (println topic13730 test))) To make this work I had to replace the symbol 'topic in the body with the gensym symbol. Is this the right way

Re: How to get a list of changes in Datomic

2014-12-28 Thread rogergl
Thanks, that helped a lot. Regards Roger -- 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 are moderated - please be patient with your first post. To

How to write tests fro vertx and Clojure

2014-12-28 Thread rogergl
Hi, it seems as if there is a test package for vertx and Clojure (vertx.testools) Since I would like to test my vertices I tried this simple approach: (tt/as-embedded (fn [] (core/deploy-verticle project/vertices/time.clj) (tt/test-complete*))) But this gives me a timeout. BTW: The

Re: How to write tests fro vertx and Clojure

2014-12-28 Thread rogergl
I think I'm getting close. The eventbus_test.clj https://github.com/vert-x/mod-lang-clojure/blob/master/api/src/test/clojure/vertx/eventbus_test.clj runs and I changed my test to: (deftest eb-send (core/deploy-verticle /project/vertices/time.clj) (let [addr const/topic-time id

Re: How to write tests fro vertx and Clojure

2014-12-28 Thread rogergl
Maybe it is a better solution to put the code I wan't to test outside the vertices and just leave the basic eventbus setup insides the vertices ? Regards Rpger -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

How to get a list of changes in Datomic

2014-12-27 Thread rogergl
I would like to replay all changes since a specific timestamp. It seems as if I can get all transactions with (q '[:find ?t :where [_ :db/txInstant ?t] ] (db conn)) Using as-of would allow me to replay the state at a given point in time. But that would replay the complete state

Batch inserts with taoensso.carmine (a Redis client) ?

2014-11-20 Thread rogergl
Is it possible to do some batch updates with taoensso.carmine ? So far I'm doing (defmacro wcar* [ body] `(car/wcar server1-conn ~@body)) (defn test-data [s n] (map (fn [i] (reverse (conj '(taoensso.carmine/set) (str i |color) blue))) (range s n))) (def data (map (fn[i] (conj (test-data i

Batch processing with taoensso.carmine (a Redis client) ?

2014-11-20 Thread rogergl
Is it possible to do some sort of batch processing with the carmine library ? So far I'm doing the following. (defn test-data [s n] (map (fn [i] (reverse (conj '(taoensso.carmine/set) (str i |color) blue))) (range s n))) (def data (map (fn[i] (conj (test-data i (+ i 2000))

How is this code evaluated (question about transdurcers)

2014-08-24 Thread rogergl
I have problems to understand how the following code evaluates. I understand what the code does but not how this result is computed: BTW: This is an example from the async webinar: (chan 1 (comp (map #(.-keyCode %)) (filter #{37 39}) (map {37 :previous 39

How to define a compojure route for SSE ?

2014-06-29 Thread rogergl
Hi, I found the following example for SSE: (def ch (channel)) ; lamina.core.channel (defn handler [request] (println request) (when (= (:uri request) /event-source) {:status 200 :headers {Content-Type text/event-stream} :body ch})) (defn handler [request] (println request)

problem with threading and sql lib

2009-09-18 Thread rogergl
The first part of my code looks like this (defn handle-client [in out] (binding [ *in* (reader in) ] (with-connection db (let [outstream (writer out)] (loop []