Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread r0man
Hi Carlo, if you'are looking for generating more complex SQL there's also: https://github.com/r0man/sqlingvo Roman. On Wednesday, July 3, 2013 10:48:07 AM UTC+2, Carlo wrote: Hey guys! I've been working on a small library to make writing SQL queries a little bit easier. It's along the

Sequential conditional transforms of an argument

2013-07-05 Thread Laurent PETIT
hello, More often than not, I'm facing code looking like this: (let [x (if (test1 x) (transform1 x) x) x (if (test2 x) (transform2 x) x) x (if (test3 x) (transform3 x) x)] x) Do you know of a better way to write this with only clojure.core functions? So far, I've had no success

Re: multiline strings and multiline comments ?

2013-07-05 Thread Laurent PETIT
2013/6/29 Niels van Klaveren niels.vanklave...@gmail.com: In my version of CCW CTRL-/ multiline (un)commenting just works (under Windows). Perhaps it's a keyboard shortcut problem ? Only problem there is when multiple lines are selected, and some are uncommented, uncommenting the whole block

Re: Sequential conditional transforms of an argument

2013-07-05 Thread Thomas Heller
Hi, you could use a macro, but a simple function should suffice. I use something along the lines of (defn cond-transform [x pairs] (reduce (fn [x [test-fn transform-fn]] (if (test-fn x) (transform-fn x) x)) x pairs)) ;; example

[ANN] modern-cljs tutorial 15 - Unit testing

2013-07-05 Thread Giacomo Cosenza
Hi all, I just published the 15th tutorial of the series modern-cljs. https://github.com/magomimmo/modern-cljs After having implemented the server side validators, it introduces unit testing. HIH My best regards Mimmo -- -- You received this message because you are subscribed to the Google

Re: multiline strings and multiline comments ?

2013-07-05 Thread Niels van Klaveren
Right, but what should be done, then? The command is a toggle, but there are both commented and uncommented lines: should it comment all lines, or uncomment all lines? I fully understand there's no right solution for this, just wanted to assure the OP that the function should work

Leiningen and s3-wagon-private load order issues?

2013-07-05 Thread Ryan Stradling
I have created a lein plugin called lein-install. Lein install is published to a private s3 repo using s3-private-wagon. That all works fine. I have another project called lein-webapp that has a project like so... :plugins [[s3-wagon-private 1.1.2] [lein-install

Re: multiline strings and multiline comments ?

2013-07-05 Thread Niels van Klaveren
Right, but what should be done, then? The command is a toggle, but there are both commented and uncommented lines: should it comment all lines, or uncomment all lines? I understand why the function works like it does, and there's no 'right' solution to this problem. I just posted this

Re: multiline strings and multiline comments ?

2013-07-05 Thread Laurent PETIT
2013/7/5 Niels van Klaveren niels.vanklave...@gmail.com: Right, but what should be done, then? The command is a toggle, but there are both commented and uncommented lines: should it comment all lines, or uncomment all lines? I understand why the function works like it does, and there's no

Re: Sequential conditional transforms of an argument

2013-07-05 Thread Mikera
I really like the as- macro for this kind of thing. (as- (something) x (if (test1 x) (transform1 x) x) (if (test2 x) (transform2 x) x) (do-something-else-with x y) (if (test3 x) (transform3 x) x)) Advantages: - It's part of core in 1.5 - It's a macro and

Re: Leiningen and s3-wagon-private load order issues?

2013-07-05 Thread Ryan Stradling
I also found this thread http://librelist.com/browser//leiningen/2012/8/29/plugins-can-t-be-on-s3/#648e7f85c85df8f7248fc9365693c20c that discusses this issue. I tried to add after the defproject form... (cemerick.pomegranate.aether/register-wagon-factory! s3p #(eval

Re: Sequential conditional transforms of an argument

2013-07-05 Thread Laurent PETIT
2013/7/5 Mikera mike.r.anderson...@gmail.com: I really like the as- macro for this kind of thing. (as- (something) x (if (test1 x) (transform1 x) x) (if (test2 x) (transform2 x) x) (do-something-else-with x y) (if (test3 x) (transform3 x) x))

Re: multiline strings and multiline comments ?

2013-07-05 Thread Michael Wood
On 5 July 2013 14:17, Laurent PETIT laurent.pe...@gmail.com wrote: 2013/6/29 Niels van Klaveren niels.vanklave...@gmail.com: In my version of CCW CTRL-/ multiline (un)commenting just works (under Windows). Perhaps it's a keyboard shortcut problem ? Only problem there is when multiple

[ANN] Pedestal 0.1.10 has been released

2013-07-05 Thread Ryan Neufeld
Hey Folks, We've just released the 0.1.10 versions of the Pedestal libraries. This release has a couple of neat improvements; the app message queue is now a priority queue (specify msg/priority :high for a high-priority message,) and service's url-for now accepts a :fragment option (among

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread Sean Corfield
And there's HoneySQL: https://github.com/jkk/honeysql (that's the one java.jdbc will recommend going forward since I worked with the author, Justin Kramer, on compatibility and direction for java.jdbc and HoneySQL at Clojure/conj last year) On Fri, Jul 5, 2013 at 3:59 AM, r0man

Re: Leiningen and s3-wagon-private load order issues?

2013-07-05 Thread Ryan Stradling
Even though I would like to know if there is a better solution it seems that the workaround using profiles (and optionally using aliases) mentioned in the thread http://librelist.com/browser//leiningen/2012/8/29/plugins-can-t-be-on-s3/#648e7f85c85df8f7248fc9365693c20c works for me. In that

Re: Anybody has tried to (re)write re-match in core.logic?

2013-07-05 Thread Norman Richards
On Thu, Jul 4, 2013 at 9:36 AM, Tassilo Horn t...@gnu.org wrote: Not sure if core.logic can do relations between infinite sets... Sure, why not? Here's a trivial example of combinations of all lists containing :x with all the lists containing :y, both infinite. (run 10 [x y] (membero :x x)

Re: multiline strings and multiline comments ?

2013-07-05 Thread Laurent PETIT
2013/7/5 Michael Wood esiot...@gmail.com: On 5 July 2013 14:17, Laurent PETIT laurent.pe...@gmail.com wrote: 2013/6/29 Niels van Klaveren niels.vanklave...@gmail.com: In my version of CCW CTRL-/ multiline (un)commenting just works (under Windows). Perhaps it's a keyboard shortcut problem

Re: Anybody has tried to (re)write re-match in core.logic?

2013-07-05 Thread Adam Saleh
What does that mean? Because right now I am using core.logic quite naively, mostly just applying recursion and some pattern matching. Adam -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Anybody has tried to (re)write re-match in core.logic?

2013-07-05 Thread Adam Saleh
Apologies, forgot that this is not a forum. 1) What would environment trimming provide me? Because right now I am using core.logic quite naively, mostly just applying recursion and some pattern matching. 2) for starting I have implemented a simple regular grammar engine, seems to work :)

Re: Anybody has tried to (re)write re-match in core.logic?

2013-07-05 Thread David Nolen
On Fri, Jul 5, 2013 at 1:13 PM, Adam Saleh adamthecam...@gmail.com wrote: Apologies, forgot that this is not a forum. 1) What would environment trimming provide me? Because right now I am using core.logic quite naively, mostly just applying recursion and some pattern matching. Handling

Re: Pedestal introduction question

2013-07-05 Thread Ryan Neufeld
Thanks, I made the update in the doc repo [1]. I'm not sure why your message took so long to drop into my non-registered email queue. I only saw an email about it late this morning. Anyways, I'll get this pushed to pedestal.io ASAP. In the future you can submit an issue or pull request to the

core.logic - Using featurec to describe relationships around keys in a map

2013-07-05 Thread David Rocamora
Hi, I'm trying to use featurec to describe some relationships within a nested map. When I try to use it to find some keys in the map it returns nothing. Here is an example: ;; Here is a map of some foods (def foods {:apple {:color Red} :carrot {:color Orange} :tomato

Re: [ANN] Fluokitten - Category theory concepts in Clojure - Functors, Applicatives, Monads, Monoids and more

2013-07-05 Thread Dragan Djuric
Thanks for the tip, Michael. I added a notification on every page, for the TL;DR crowd, so I hope that will catch the attention of enough people and improve the future readability of the docs. On Wednesday, July 3, 2013 2:34:33 PM UTC+2, Michael Klishin wrote: 2013/7/3 Dragan Djuric

(newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Colin Yates
Hi all, I think this is one of those questions which has quite a few answers, but given a map, how do I replace the values by applying a function to those values, but only if they meet a condition? I understand the building blocks of (map..), (filter..), (assoc-in..) and (filter..) and I can

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread John Walker
I had to do something similar, and used clojure.walk.http://clojuredocs.org/clojure_core/clojure.walk/walk On Friday, July 5, 2013 8:59:54 PM UTC, Colin Yates wrote: Hi all, I think this is one of those questions which has quite a few answers, but given a map, how do I replace the values

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Jim - FooBar();
You'll never really 'replace' any values so why not reduce/reduce-kv ? Just build a new map out of the old one... Jim On 05/07/13 21:59, Colin Yates wrote: Hi all, I think this is one of those questions which has quite a few answers, but given a map, how do I replace the values by applying

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Jay Fields
I use update-vals from https://github.com/jaycfields/jry fairly often. As long as you don't mind doing the pred check in the fn you pass to update-vals, it should do the trick. Cheers, Jay On Fri, Jul 5, 2013 at 5:14 PM, Jim - FooBar(); jimpil1...@gmail.comwrote: You'll never really 'replace'

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Jim - FooBar();
I 'd change the implentation of update-vals to use reduce-kv. you will avoid the cost of destructuring on every single step :) Jim On 05/07/13 22:15, Jay Fields wrote: I use update-vals from https://github.com/jaycfields/jry fairly often. As long as you don't mind doing the pred check in

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Colin Yates
Grrr.. google groups seems to be playing up so apologies if this is double posted. Thanks both! My attempt (inspired by Stuart Sierra's reply at https://groups.google.com/forum/#!topic/clojure/Hlfn4PdKg-k) was something like this (from memory so forgive me): (defn val-or-date [result [k v]]

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Ben Wolfson
You could use clojure.algo.generic.functor.fmap: (fmap #(if (pred? %) replacement-value %) your-map). On Fri, Jul 5, 2013 at 2:08 PM, John Walker jouiswal...@gmail.com wrote: I had to do something similar, and used clojure.walk.http://clojuredocs.org/clojure_core/clojure.walk/walk On

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Cedric Greevey
Even without reaching for libraries outside clojure.core, there's (update-in m [:key-of-interest] #(if (condition? %) (transformation %) %)) and the ability to convert that into a function, e.g. (defn conditional-update-in [m condition? transformation k] (update-in m [k] #(if (condition? %)

Re: Sequential conditional transforms of an argument

2013-07-05 Thread Mikera
On Friday, 5 July 2013 16:52:10 UTC+1, Laurent PETIT wrote: 2013/7/5 Mikera mike.r.an...@gmail.com javascript:: I really like the as- macro for this kind of thing. (as- (something) x (if (test1 x) (transform1 x) x) (if (test2 x) (transform2 x) x)

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Justin Kramer
Besides post-processing results, you can also instruct java.jdbc to return Joda dates in the first place. Using clojure.java.jdbc 0.3.0-alpha4: (ns example (:require [clojure.java.jdbc :as j] [clj-time.local :as cl])) ... (extend-protocol j/IResultSetReadColumn java.sql.Date

Re: core.async JAR

2013-07-05 Thread David Pollak
I've found the core.async files are in snapshots... this line in project.clj works for me: :repositories {sonatype-oss-public https://oss.sonatype.org/content/repositories/snapshots/} On Fri, Jul 5, 2013 at 12:24 AM, James Reeves ja...@booleanknot.com wrote: On 4 July 2013 15:20, pmf

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread Carlo Zancanaro
Hey Roman, The issue that I see with `sqlingvo`, and the thing which I was trying to solve for myself, is that it doesn't compose well. Unless I'm missing something, you have to generate the entire query in the one `sql` form. To me, this is a big restriction and was the number one thing I was

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread Carlo Zancanaro
Hey Sean, Most of the points in my reply to Roman also apply to `HoneySQL`. In particular this phrase in the README summarises a good deal of my criticism: When using the vanilla helper functions, new clauses will replace old clauses. You have to go out of your way to get the composability that I

Re: Offline Clojure docs

2013-07-05 Thread Tom Faulhaber
It's easy to pull the autodoc documentation for offline use. You can either do this: $ git clone https://github.com/clojure/clojure.git clojure-api $ cd clojure-api $ git checkout gh-pages or you can just open https://github.com/clojure/clojure/archive/gh-pages.zip; or pull the directory with

Re: Offline Clojure docs

2013-07-05 Thread Kelker Ryan
wget -k -m http://clojure-doc.org/wget -k -m http://clojuredocs.org/ 06.07.2013, 12:59, "Tom Faulhaber" tomfaulha...@gmail.com:It's easy to pull the autodoc documentation for offline use. You can either do this: $ git clone https://github.com/clojure/clojure.git clojure-api$ cd clojure-api$ git

Re: Web crawling tree traversal

2013-07-05 Thread Gary Trakhman
I wrote this a while ago, here it is :-) https://github.com/gtrak/betamore-clj/blob/master/src/betamore_clj/core.clj On Thu, Jul 4, 2013 at 1:23 PM, Amir Fouladi ah.foul...@gmail.com wrote: Hi everybody I'm a clojure newbie, so I'm sorry if I'm asking a dumb question. I'm trying to write a