thread-any macro "%>"

2014-11-15 Thread Krzysiek Herod
Guys, what do you think about new thread macro (I would call it thread-any and represent it as "%>"), that would require you to always specify the position of the argument you want to pass to the function? This code: (defn csv-line->sql-line [table, line] (-> line (str " ") (str/

Re: thread-any macro "%>"

2014-11-15 Thread Timothy Baldridge
That was added to clojure.core in 1.6 and is known as "as->" https://clojuredocs.org/clojure.core/as-%3E On Sat, Nov 15, 2014 at 6:55 AM, Krzysiek Herod wrote: > Guys, what do you think about new thread macro (I would call it thread-any > and represent it as "%>"), that would require you to al

Re: thread-any macro "%>"

2014-11-15 Thread Nicola Mometto
as-> only binds the specified expression rather than each result in step and only works from within -> Timothy Baldridge writes: > That was added to clojure.core in 1.6 and is known as "as->" > https://clojuredocs.org/clojure.core/as-%3E > > > > On Sat, Nov 15, 2014 at 6:55 AM, Krzysiek Herod >

Re: thread-any macro "%>"

2014-11-15 Thread Bronsa
Looks like I've been too fast in my reply, looking at the docstring I see that I'm wrong and you're right. I didn't realize as-> could take more than one "body" On Sat, Nov 15, 2014 at 3:05 PM, Nicola Mometto wrote: > > as-> only binds the specified expression rather than each result in step > an

defn inside defn

2014-11-15 Thread Udayakumar Rayala
Hi, Is it idiomatic to have defn inside defn? eastwood throws def-in-def warning when I have the following code: (defn double-square [y] (defn square [x] (* x x)) (+ (square y) (square y))) The above code is a simplified example to show the problem. In the above case, square

Re: defn inside defn

2014-11-15 Thread David Nolen
Not idiomatic. defn is always top level. David On Sat, Nov 15, 2014 at 11:31 AM, Udayakumar Rayala wrote: > twice> > > Hi, > > Is it idiomatic to have defn inside defn? eastwood throws def-in-def warning > when I have the following code: > > (defn double-square [y] > (defn square [x] (*

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-15 Thread Ben Wolfson
or (defn enumerate [xs] (map vector (range) xs)) (defn altsum [n] (reduce (fn [acc [i f]] (f acc (inc i))) 0 (take n (enumerate (cycle [+ -]) On Fri, Nov 14, 2014 at 3:41 PM, Andrew Oberstar wrote: > How about this? > > (defn cyclefn > [

Re: defn inside defn

2014-11-15 Thread Andy Fingerhut
Not idiomatic. All Eastwood warnings except for one have some documentation explaining what kinds of things they warn about, and sometimes why they warn about them. The def-in-def warning documentation is available here: https://github.com/jonase/eastwood#def-in-def As it says there, def's i

Re: defn inside defn

2014-11-15 Thread Fluid Dynamics
On Saturday, November 15, 2014 11:31:50 AM UTC-5, Udayakumar Rayala wrote: > > twice> > > Hi, > > Is it idiomatic to have defn inside defn? eastwood throws def-in-def > warning when I have the following code: > > (defn double-square [y] > (defn square [x] (* x x)) > (+ (square y)

Re: testing platform , midje or specjl ?

2014-11-15 Thread Steve Ford
Hi Colin I'm a beginner, and I started with midje. But I was very interested to read your thoughts about clojure.test being more opinionated. Since I'm still learning, I suspect I would benefit from clojure.test's encouragement to be more idiomatic. However, one thing I absolutely love is mi

Re: If code is data why do we use text editors?

2014-11-15 Thread Johannes
Perhaps a look at subtext (http://www.subtext-lang.org/demo1.html) could be interesting. Johannes -- 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 mode

Re: testing platform , midje or specjl ?

2014-11-15 Thread Colin Yates
Hi Steve, https://github.com/technomancy/leiningen/wiki/Plugins has a few listed. There is also the non-specific https://github.com/weavejester/lein-auto as well. Hope this helps, and good luck testing! Colin On 15 Nov 2014 20:19, "Steve Ford" wrote: > Hi Colin > > I'm a beginner, and I start

Re: testing platform , midje or specjl ?

2014-11-15 Thread Colin Yates
As a P.S. I did say it was more opinionated, but on hindsight I am not sure that is the right phrase. I meant that it was intentionally simple so there was less room to hang yourself as oppose to midje which is excellent but can more easily accommodate poor behaviour. For example, in the early da

Re: thread-any macro "%>"

2014-11-15 Thread Gary Verhaegen
It also does not really care whether or not it is inside a ->, it just reads nicer when it is. (as-> 4 x (+ x 2) (* x 7) should return 42, although I can't check on my phone. On Saturday, 15 November 2014, Bronsa wrote: > Looks like I've been too fast in my reply, looking at the docstring I >

Re: Library to create/apply patches of clojure data

2014-11-15 Thread Karsten Schmidt
Hi Robin, I just found a link to this library in the depths of the Liberator docs: https://github.com/daviddpark/clj-json-patch Maybe that's more helpful... (haven't tried it myself, but had to think of you) On 14 November 2014 07:35, Robin Heggelund Hansen wrote: > If you look at the issues li

Re: Library to create/apply patches of clojure data

2014-11-15 Thread Robin Heggelund Hansen
Thank you for the link. This doesn’t, from what I can tell, work on all Clojure datastructures, but a JSON-compatible subset. > 15. nov. 2014 kl. 23.09 skrev Karsten Schmidt : > > Hi Robin, I just found a link to this library in the depths of the > Liberator docs: > > https://github.com/davidd

Re: Library to create/apply patches of clojure data

2014-11-15 Thread Karsten Schmidt
Yes, understood, but I thought it would give you at least a headstart... On 15 November 2014 22:13, Robin Heggelund Hansen wrote: > Thank you for the link. This doesn’t, from what I can tell, work on all > Clojure datastructures, but a JSON-compatible subset. > > >> 15. nov. 2014 kl. 23.09 skrev

Re: testing platform , midje or specjl ?

2014-11-15 Thread Brian Marick
On Nov 15, 2014, at 3:52 PM, Colin Yates wrote: > For example, in the early days I was particularly susceptible to writing > functions which did too much and called too many other functions. With Midje, > mocking these other functions was trivial, on hindsight a bit more pain would > have bee

Re: thread-any macro "%>"

2014-11-15 Thread Henrik Eneroth
You can find this functionality in the Swiss Arrows library here: https://github.com/rplevy/swiss-arrows My first thought was that using the % symbol seems cleaner than the <> of Swiss Arrows. Thinking about it though, wouldn't overloading the % create trouble when you do want to use the litera

Re: testing platform , midje or specjl ?

2014-11-15 Thread Steven Degutis
There's more to it than just style differences. Some of them have capabilities and offer functionality that others don't have, which may push you towards using such a one if you have a real need for those features. Disclaimer: I'm one of the maintainers of Speclj, which we use it at work, and whic

Re: If code is data why do we use text editors?

2014-11-15 Thread Mike Haney
Colin - I'm just curious if you have any experience with Jetbrains MPS? I was into it pretty heavily before I got into Clojure, and I've thought a lot about how to add support for Clojure to it (would be pretty straightforward, actually), but haven't had the time to pursue it or the conviction

Re: Library to create/apply patches of clojure data

2014-11-15 Thread Vladimir Bokov
Hi Robin, I'm also highly interested in the subject as I'm trying to do essentially the same - reduce the client-server traffic using diffs over websocket. I think a diff solution is only the basis, I think we should look at some VCS-like implementation to be able to merge some changes and to b

Re: If code is data why do we use text editors?

2014-11-15 Thread Colin Fleming
Hi Mike, Actually, I haven't - I probably should spend more time investigating it, there are bound to be some interesting ideas. If you have thoughts about aspects of it that might be useful, I'd be very interested in hearing about them either on or off list (co...@colinfleming.net). On 16 Novemb